"Token signature verification failed" when creating an order
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have been trying to learn how to use PayPal by using the following link:
https://developer.paypal.com/docs/business/checkout/
In particular, I am getting stuck on the 'Advanced Credit and Debit Card Payments' and I seem to be getting an error indicating that my token signature is invalid. I am in the UK and have setup a personal and business sandbox account in GBP. At present I am following this procedure:
1 - Get an access token using something similar to this:
curl -v POST https://api-m.sandbox.paypal.com/v1/oauth2/token \
-H "Accept: application/json" \
-H "Accept-Language: en_US" \
-u "[CLIENT_ID]:[SECRET]" \
-d "grant_type=client_credentials"
This works and returns data containing an access token.
2 - Next I try to get a client token using something similar to this:
curl -X POST https://api-m.sandbox.paypal.com/v1/identity/generate-token \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer ...[ACCESS_TOKEN].....' \
-H 'Accept-Language: en_US'
This works and returns a very large client token.
3 - Finally I try to create an order by running something similar to this:
curl -v -X POST https://api-m.sandbox.paypal.com/v2/checkout/orders \-H "Content-Type: application/json" \-H "Authorization: Bearer ...[CLIENT_TOKEN]...." \
-d '{
"intent": "CAPTURE",
"purchase_units": [
{
"amount": {
"currency_code": "USD",
"value": "100.00"
}
}
]
}'
This is where I hit a problem. It returns the following error:
{"error":"invalid_token","error_description":"Token signature verification failed"}
I decided to change the Accept-Language: en_US to Accept-Language: en_GP and change the "currency_code": "USD", to "currency_code": "GBP", just incase it was something to do with the account currency. Unfortunately I get the same error:
{"error":"invalid_token","error_description":"Token signature verification failed"}
I would really appreciate if you could help with this. Also if you have any suggestions on how to get better with this and debug API calls, I would really appreciate it. Is there a quick way to get support ?
Thanks
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey @MarkyMark1000 - I had the same issue when I was using Shell environment variables, specifically when using the single quotes with a variable.
This:
curl -X POST https://api-m.sandbox.paypal.com/v1/identity/generate-token \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer ${ACCESS_TOKEN}' \
-H 'Accept-Language: en_US'
Returns:
{"error":"invalid_token","error_description":"Token signature verification failed"}
This will work (using double quotes):
curl -X POST https://api-m.sandbox.paypal.com/v1/identity/generate-token \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer ${ACCESS_TOKEN}" \
-H 'Accept-Language: en_US'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm having a similar problem but I am coding in VS code. When I click the paypal button I get:
"Could not initiate PayPal Checkout...
Error: {"error":"invalid_token","error_description":"Token signature verification failed"}".
How can I fix this in my environment?
here is a code snippet where I found the problem to be. the "orderData.id" is returning false. why?

Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- phone verification problem in PayPal Reporting
- IPN simulator always send INVALID answer in Sandbox Environment
- Verification issues to transfer money to my own bank in PayPal Upgrade Community
- Paypal 3DS intigration error in NVP/SOAP APIs
- I keep getting the error: “Unfortunately, a system error has occurred" in NVP/SOAP APIs