Orders get request error 500
Mortodox
Contributor
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
Jun-12-2019
07:05 AM
Hello,
I've set up the PayPal checkout system, when I make a payment everything goes well but when I try to retrieve the transaction details on the server side as indicated on the documentation the following error is sent to me:
{"error": "invalid_token", "error_description": "Token signature verification failed"}
or:
{"error":"invalid_client","error_description":"Client credentials are missing"}
Could you tell me what I forgot to do ? I did follow the documentation....
https://developer.paypal.com/docs/checkout/integrate/#6-verify-the-transaction
My code (PHP) :
[...]
$orderId = $request->getContent();
try {
// paypal-checkout-sdk
$client = PayPalClient::client();
$getOrder = new OrdersGetRequest($orderId);
$getOrder->headers["Authorization"] = "Bearer xxxx:xxxx";
$response = $client->execute($head);
} catch (\Exception $e) {
throw $e;
}
[...]
JS :
paypal.Buttons({
env: 'sandbox',
client: {
sandbox: 'xxx'
},
createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [{
amount: {
value: '0.03'
}
}]
});
},
onApprove: function(data, actions) {
// Capture the funds from the transaction
return actions.order.capture().then(function(details) {
// Show a success message to your buyer
//alert('Transaction completed by ' + details.payer.name.given_name);
console.log(data);
// Call your server to save the transaction
return fetch('https://xx.xx.xx/fr/purchase/paid/', {
method: 'POST',
headers: {
'content-type': 'application/json'
},
body: JSON.stringify({
orderID: data.orderID
})
});
});
},
onCancel: function(data) {
jQuery('#checkoutHolder').html('The checkout failed please refresh the page and try again.');
jQuery(".payPalButton").hide();
}
}).render('#paypal-button');
Thank you for your help.
Labels:
- Labels:
-
Payments REST APIs
1 REPLY 1
Mortodox
Contributor
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun-18-2019
12:15 AM
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
Related Content
- link my PayPal business account with my WordPress website , but it's not work ?! in PayPal Payments Standard
- Change the button from Sandbox to Production in PayPal Payments Standard
- “This payment cannot be processed because there was an error with the capture order API call”. in REST APIs
- When I do PayPal capture Order, I keep on getting Invalid Request Connection in REST APIs
- [UNPROCESSABLE_ENTITY], but payment went through in PayPal Payments Standard