Order capture not working
samebenezer
Contributor
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
Feb-13-2020
04:36 AM
I've tried to follow the paypal documentation closely.
But for some reason my server integration isn't working 😢....
Could you help identify what i'm doing wrong?
Client side
onApprove: function(data) {
return fetch('/server-side-file-name', {
headers: {
'content-type': 'application/json'
},
body: JSON.stringify({
orderID: data.orderID
})
}).then(function(res) {
return res.json();
}).then(function(details) {
alert('Transaction funds captured from ' + details.payer_given_name);
})
}
ON the SERVER SIDE
if (!count(debug_backtrace()))
{
$json = file_get_contents('php://input');
$data = json_decode($json);
$orderid = $data->orderID;
CaptureOrder::captureOrder($orderid, true);
}
Labels:
Login to Me Too
- Labels:
-
Payments REST APIs
0 REPLIES 0

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
- CHECKOUT.ORDER.APPROVED webhook event not triggered if payment_source is passed in in REST APIs
- Why does PayPal redirect to different pages (login vs credit card form) depending on browser mode? in Braintree Server-side Integration (PHP, Java, .NET, Ruby, Python, NodeJS SDKs)
- webhook payment capture completed issue in Sandbox Environment
- Paypal 3DS intigration error in NVP/SOAP APIs
- PERMISSION_DENIED trying to refund capture in live mode in REST APIs