REST API Error 500 when capturing order
Cos280
Contributor
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
Sep-11-2022
01:41 PM
Hello,
I am trying to capture a payment but I keep receiving error 500.
I followed the guide (translated to PHP for my needs) so I can not see where is my mistake.
My back is in PHP/Symfony so I use HTTPClient to send the request:
$response = $this->client->request('POST', sprintf('%s/%s/checkout/orders/%s/capture', $this->url, 'v2', $orderID), [
'auth_bearer' => $this->accessToken,
'headers' => [
'Content-Type' => 'application/json',
'PayPal-Request-Id' => $payment->getClientToken()
],
'json' => null
]);
I added 'json' => null to force the request as application/json.
Also I noticed some little problems, I could not authenticate on v2 URLs I have to use v1 and process payment to v2.
The sample request for the capture URL in the REST API doc is not accurate and contains error (authorize instead of capture in the URL).
Do someone had this problem and solved it?
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
- Advance checkout in Braintree Server-side Integration (PHP, Java, .NET, Ruby, Python, NodeJS SDKs)
- webhook payment capture completed issue in Sandbox Environment
- PERMISSION_DENIED error for checkout/orders/{order_id} endpoint in REST APIs
- Are there any restrictions to charge using only html, vanilla javascript and php with rest api? in REST APIs
- Compliance violation. flag based on the account origin ? in Sandbox Environment