Rest API payment execute TRANSACTION_REFUSED in sandbox
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am working with php. I have only one item to sell. I set up a Rest API process that is working fine, but the payment execute always returns TRANSACTION_REFUSED as follows:
{"name":"TRANSACTION_REFUSED","details":[],"message":"The request was refused","information_link":"https://developer.paypal.com/docs/api/payments/#errors","debug_id":"cb4b790f444ab"}
status 400.
After the buyer has approved the sale in paypal using the approval_url from the create payment,
I'm using the execute link returned from the create payment to finish the sale:
Here my php script:
$json_data = '{
"payer_id": "'.$payerid.'"
}';
// $ehref = the link from above.
$ch = curl_init($ehref);
curl_setopt($ch, CURLOPT_HEADER, false); // don't return headers
curl_setopt($ch, CURLOPT_SSLVERSION , 6);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $json_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Authorization: Bearer '.$access_token)
);
$json_response = curl_exec($ch);
My paypal account is in EUR. The sandbox account I'm using for the buyer is in USD. I first tried the whole thing simply using the Paypal button solution, which worked fine. But I need more. So I decided to set up the sale as Rest API. (I did before as express checkout, but that isn't working anymore, so I decided to rebuild completly.)
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- I met the 422 response, and tries a lot solutions in the community but still not work in REST APIs
- API TRANSACTION_REFUSED in Sandbox when Capturing Payment in REST APIs
- Url () is not a fully qualified URL in REST APIs
- Invalid selector error when PayPalButtons is rendered in SDKs
- Logging in with Sandbox account fails silently, appears to CSP failure in chrome in Sandbox Environment