REST API Error 500 when capturing order

Cos280
Contributor
Contributor

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?

Login to Me Too
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.