Paypal Internal Server Error Rest approval Payment - api

I have a problem when creating an approval Payment using REST API.
i'm creating a payment with pyment_method = 'paypal'
while i'm sending to paypal server my json file as
"{"transactions":[
{"amount":{"currency":"USD","total":"12","details":{}},
"description":"This is the payment transaction description."}
]
,"links":[],
"intent":"sale","payer":{
"funding_instruments":[],"payment_method":"paypal"}
}"
this is
result: Object
debug_id: "086b180fbe2f1"
information_link: "https://developer.paypal.com/webapps/developer/docs/api/#INTERNAL_SERVICE_ERROR"
message: "An internal service error has occurred"
name: "INTERNAL_SERVICE_ERROR"

Paypal frequently returns internal server error. This is common in sandbox mode.
The most common is to try again and get execute.
Try:
https://github.com/paypal/rest-api-sdk-nodejs/issues/1

You are including elements you shouldn't be, and missing important ones. If you are setting up a PayPal payment you need to have cancel and return urls:
{
"redirect_urls":{
"return_url":"http://<return URL here>",
"cancel_url":"http://<cancel URL here>"
},
"transactions":[
{
"amount":{
"currency":"USD",
"total":"12.00"
},
"description":"This is the payment transaction description."
}
],
"intent":"sale",
"payer":{
"payment_method":"paypal"
}
}
See Accepting a PayPal Payment for a guide

In my case I set the Content-Type header to application/json and get meaningful response:
{"name":"MALFORMED_REQUEST","message":"Incoming JSON request does not map to API request","information_link":"https://developer.paypal.com/webapps/developer/docs/api/#MALFORMED_REQUEST","debug_id":"688b8ab4b2895"}
Instead of:
<ns1:XMLFault xmlns:ns1="http://cxf.apache.org/bindings/xformat"><ns1:faultstring xmlns:ns1="http://cxf.apache.org/bindings/xformat">java.lang.NullPointerException</ns1:faultstring></ns1:XMLFault>

Related

Auth0 API Create User returns Client ID Not Found

I am using the Auth0 Management API page to test creating a user.
https://auth0.com/docs/api/management/v2#!/Users/post_users
I am sending the following body to POST:/api/v2/users:
{
"email":"me#test.com",
"password":"123DEDed1!",
"connection":"My-Users"
}
However I get the following response:
{
"statusCode": 400,
"error": "Bad Request",
"message": "Sandbox Error: Client: '{{REDACTED}}: Client id not found'"
}
Obviously the client ID does exist. Any ideas what I am doing wrong?
We found the issue was actually internal to another script we had configured in the Action Login Flow

kucoin websocket api, how to "subscribe" to their public channel, they say no authorization required, but they ask for a token :(

The question is about kucoin websocket public channel (not trades) just last trades
I just want a live feed of trades like other crypto exchanges...
but when I want to connect to "wss://ws-api-futures.kucoin.com/endpoint" I get WebSocketError: Received unexpected status code (401 Unauthorized)
the documentation https://docs.kucoin.com/futures/#create-connection lack explications :(
normally with other exchanges I can just do this in javascript
bybit_market_ws = new WebSocket("wss://stream.bybit.com/spot/quote/ws/v2");
bybit_market_ws.onmessage = event => bybit_trades(event.data);
bybit_market_ws.onopen = event => bybit_market_ws.send(JSON.stringify({"topic":"trade","params":{"symbol":"BTCUSDT","binary":false},"event":"sub"}));
function bybit_trades (jsonx) { console.log(JSON.parse(jsonx)); }
so how can I do that with kucoin websocket ?
according to the documentation i would need a "public token"...
but there is no explication on how to get that token :(
does someone knows how I would retrieve the last trades via websocket (public) channel ?
Note that the following steps may be changed when the API is updated.
All information can be found at https://docs.kucoin.com/#apply-connect-token
Get the public token
Send a empty http POST (GET will not work) message to https://api.kucoin.com/api/v1/bullet-public.
Response:
{
"code": "200000",
"data": {
"token": "2neAiuYvAU61ZD...",
"instanceServers": [
{
"endpoint": "wss://ws-api.kucoin.com/endpoint",
"encrypt": true,
"protocol": "websocket",
"pingInterval": 18000,
"pingTimeout": 10000
}
]
}
}
Connect to the Websocket
With the data of the repsonse above:
websocket: endpoint + "?token=" + token
Example: wss://ws-api.kucoin.com/endpoint?token=2neAiu....
Get all supported trading pairs
send a http GET message to https://api.kucoin.com/api/v1/symbols
{
"code": "200000",
"data": [
{
"symbol": "REQ-ETH",
"name": "REQ-ETH",
"baseCurrency": "REQ",
"quoteCurrency": "ETH",
...
},
{
"symbol": "BTC-USDC",
"name": "BTC-USDC",
"baseCurrency": "BTC",
"quoteCurrency": "USDC",
...
},
...
Get trading data
When the websocket connection is established send a http POST message:
{
"type": "subscribe", //subscribe or unsubscribe
"topic": "/market/ticker:BTC-USDT,BTC-USDC"
}
maybe this answer will not please you at all, but i will try, most of the people who work from the API in KuCoin do it with python, in fact the SDK for Nodejs is out of date, your best bet is to ask in the telegram channel https://t.me/KuCoin_API, there are KuCoin engineers who always help, although most of them use python, there is also the academy channel https://t.me/kucoin_learning, where there are examples, in short I can only mention references because I was also where you are, and the best I could do was that and review the SDk code and from there intuit and create my own adjustments
PD: the datafeed.js file is your best option, check it out https://github.com/Kucoin/kucoin-futures-node-sdk/blob/master/src/lib/datafeed.js

Odata v4 and axios request for React native has error on IOS only, Android has good response

I have used a get Axios request with Backend Dynamics 365 that has Odata for Rest APIs.
I have a good response on a get request API that has no parameters. But When I use other get APIs that have a parameter, then I get an error response with data.
"data": Object {
"error": Object {
"code": "",
"message": "The supplied company name is not valid.",
},
},
API URL:
Request type: GET
/APP/ODataV4/Company('United%20Traders%20Syndicate%20P.Ltd')/AppVehicles?$filter= appUsername eq 'SUMBEAST'
This error does not occur in android.
Issue some how solved by removing
/Company('United%20Traders%20Syndicate%20P.Ltd')/
removed the required part from the API with help of backend developer
guess ios doesnot take % properly

Create MasterCard tokenization API

I have a mobile app containing payment method via MasterCard. I have this tutorial:
https://ap-gateway.mastercard.com/api/documentation/apiDocumentation/rest-json/version/latest/api.html?locale=en_US
I want to create Tokenization which contains customer's master detail, I have followed this tutorial part:
https://ap-gateway.mastercard.com/api/documentation/apiDocumentation/rest-json/version/latest/operation/Tokenization%3a Create or Update Token (with system-generated token).html?locale=en_US
I tried with :
POST https://ap-gateway.mastercard.com/api/rest/version/41/merchant/{{MyMerchantID}}/token
Params:
{
"sourceOfFunds": {
"type": "CARD",
"provided": {
"card":{
"number": "5123450000000008",
"expiry": {
"month": "05",
"year": "17"
}
}
}
Note: The number is a mastercard test number.
I am always get this error:
error
cause "INVALID_REQUEST"
explanation "Invalid credentials."
result "ERROR"
I followed the params in second URL.
Can anyone help? Are the params correct or I missed something?
In your configuration file, you need to set the following:
$configArray["merchantId"] = "[merchantId]";
// API username in the format below where Merchant ID is the same as above
$configArray["apiUsername"] = "merchant.[merchantId]";
// API password which can be configured in Merchant Administration
$configArray["password"] = "your api password";
Setting the above parameters in the config file will solve your problem
Try replacing "ap-gateway" with the real gateway provided for you. Your merchantID is not supported in test gateway.
First, you should ask you bank to enable the tokenization for your merchant account
POST
https://ap-gateway.mastercard.com/api/rest/version/61/merchant/{{MyMerchantID}}/token
you have to set Authorization->Basic Auth
Username : Your_MerchantID
Password : ApiPassword
Params:
{
"session": {
"id": "SESSION0002510583427E2239608H32"
}
}

Square REST API: Error issuing refund

Every time I try to refund a card, I get the JSON pasted below. This happens after I authorize a card, then capture the charge, then want to issue a partial refund. For “tender_id” I have tried both the transaction ID and the ID I am handed during the authorization. Of course for the capture there is no tender_id or id because a successful capture returns just “{}”.
I am also using sandbox credentials. The charge was done with a nonce generated with sandbox credentials as well.
What’s wrong?
Thanks...
POST to:
https://connect.squareup.com/v2/locations/CBASEHHNorL75TjuSOAvKQLnuNYgAQ/transactions/a2905f34-c8e8-5534-7676-82e8c580e9bf/refund
With this JSON:
{
"idempotency_key":"6464dc19-1703-47c0-81f9-4f0f1361eada",
"tender_id":"291d56b3-1e73-5bff-6e8e-719fd134b83f",
"reason":”Partial refund",
"amount_money":{
"amount":4500,
"currency":"USD"
}
}
Gives this reply:
{
"errors": [
{
"category": "INVALID_REQUEST_ERROR",
"code": "NOT_FOUND",
"detail": "Location `CBASEHHNorL75TjuSOAvKQLnuNYgAQ` does not have a transaction tender with ID `291d56b3-1e73-5bff-6e8e-719fd134b83f`."
}
]
}
UPDATE: The result from the requested GET call (in the comments to the answer) is:
{
"transaction":{
"id":"a2905f34-c8e8-5534-7676-82e8c580e9bf",
"location_id":"CBASEHHNorL75TjuSOAvKQLnuNYgAQ",
"created_at":"2017-02-21T22:08:10Z",
"tenders":[
{
"id":"a18b98c7-5ac7-51c1-618c-3b95ee124c1b",
"location_id":"CBASEHHNorL75TjuSOAvKQLnuNYgAQ",
"transaction_id":"a2905f34-c8e8-5534-7676-82e8c580e9bf",
"created_at":"2017-02-21T22:08:10Z",
"note":"Online Transaction",
"amount_money":{
"amount":12500,
"currency":"USD"
},
"processing_fee_money":{
"amount":372,
"currency":"USD"
},
"type":"CARD",
"card_details":{
"status":"CAPTURED",
"card":{
"card_brand":"VISA",
"last_4":"5858"
},
"entry_method":"KEYED"
}
}
],
"reference_id":"63614ae8-539a-4339-b5c7-554bae64fbed",
"product":"EXTERNAL_API"
}
}
After you capture, have you tried listing/retrieving the transaction to get the full details, including tender ids? Could you post your response from GET /v2/locations/CBASEHHNorL75TjuSOAvKQLnuNYgAQ/transactions/a2905f34-c8e8-5534-7676-82e8c580e9bf if that doesn't work?