I want to ask about paypal REST execute process. As defined in the documentation,
curl -v https://api.sandbox.paypal.com/v1/payments/payment/payment_id/execute/ \\
-H "Content-Type:application/json" \\
-H "Authorization: Bearer Access-Token" \\
-d '{
"payer_id": "payer_id"
}'
the code is for curl version which I want to change to guzzle version but am bit confused about "Authorization: Bearer Access-Token"
Is "Authorization: Bearer Access-Token" is placed on header config like "Content-Type:application/json" ?
Because I always get error 500 from Paypal sandbox server and when I tried to access API Call history page on Paypal sandbox dashboard it always show "Something went wrong fetching sandbox API calls. Try again."
Yes, currently the best option to implement Bearer
authentication is to add a header:
$response = $client->post(
'https://api.sandbox.paypal.com/v1/payments/payment/payment_id/execute/',
[
'headers' => ['Authorization' => 'Bearer #your_token#'],
'json' => ['payer_id' => '#your_payer_id#'],
]
);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.