API Authentication failed due to invalid authentication credentials or a missing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am trying to set up a POST request to the Order API. I have my authentication working and getting an access_token back, but when I try to send my Order request, it says "Authentication failed due to invalid authentication credentials or a missing..."
- Labels:
-
API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @eibachcv ,
Thank you for posting to the PayPal Merchant Community.
The error message usually means that the access token is missing from the headers. Once you get the access token, make certain that you are sending it in the request. The request should look something like this (make sure to pass your access_token into the Authorization: Bearer header:
https://developer.paypal.com/docs/api/orders/v2/#orders_create -> has examples in Payload, cURL, Node.js, Java, Python
curl -v -X POST https://api-m.sandbox.paypal.com/v2/checkout/orders \
-H 'Content-Type: application/json' \
-H 'PayPal-Request-Id: 7b92603e-77ed-4896-8e78-5dea2050476a' \
-H 'Authorization: Bearer {{access_token}}' \
-d '{
"intent": "CAPTURE",
"purchase_units": [
{
"reference_id": "d9f80740-38f0-11e8-b467-0ed5f89f718b",
"amount": {
"currency_code": "USD",
"value": "100.00"
}
}
],
"payment_source": {
"paypal": {
"experience_context": {
"payment_method_preference": "IMMEDIATE_PAYMENT_REQUIRED",
"payment_method_selected": "PAYPAL",
"brand_name": "EXAMPLE INC",
"locale": "en-US",
"landing_page": "LOGIN",
"shipping_preference": "SET_PROVIDED_ADDRESS",
"user_action": "PAY_NOW",
"return_url": "https://example.com/returnUrl",
"cancel_url": "https://example.com/cancelUrl"
}
}
}
}'
Thank you,
Jennifer
PayPal
MTS
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- Webhook deregistration issue and event validation issue in REST APIs
- How to retrieve merchant integration status through the API? in REST APIs
- Problem setting up Third-Party API Users in NVP/SOAP APIs
- Is anyone having a problem integrating a Business Account into the WordPress store? in PayPal Payments Standard
- I Have PayPal API Billing Authentication Failure Python-Flask in REST APIs