Access Token not found in cache

StudiFH
Contributor
Contributor

Hi i'm trying to implement a multi seller plattform, but when i create an order I always get this error:

$ curl -v -X POST https://api-m.sandbox.paypal.com/v2/checkout/orders \
> -H 'Content-Type: application/json' \
> -H 'PayPal-Partner-Attribution-Id: FLAVORsb-7vgls6637891_MP' \
> -H 'Authorization: Bearer A21AAIqLh0PtyEOBcKKjpE1BVdkOz9E67xUfC6-OdK12GAAotFGdM2zY7f9NFSAqvMsGFZrFjGp6F6VPxL1PhIVpIvM2arhEA' \
> -d '{
> {
> {
> "intent":"CAPTURE",
> "purchase_units":[
> {
> "reference_id":"REFID-1",
> "payee": {
> "email_address": "sb-7ey2d6637819(at)business.example.com"
> },
> "amount":{
> "currency_code":"USD",
> "value":"100.00"
> },
> "payment_instruction":{
> "disbursement_mode":"INSTANT",
> "platform_fees":[
> {
> "amount":{
> "currency_code":"USD",
> "value":"2.00"
> }
> }
> ]
> }
> },
> {
> "reference_id":"REFID-2",
> "payee": {
> "email_address": "sb-tfd716638160(at)business.example.com"
> },
> "amount":{
> "currency_code":"USD",
> "value":"50.00"
> },
> "payment_instruction":{
> "disbursement_mode":"INSTANT",
> "platform_fees":[
> {
> "amount":{
> "currency_code":"USD",
> "value":"2.00"
> }
> }
> ]
> }
> }
> ]
> }'
Note: Unnecessary use of -X or --request, POST is already inferred.
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Trying 151.101.129.35:443...
* Connected to api-m.sandbox.paypal.com (151.101.129.35) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
* CApath: none
} [5 bytes data]
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
} [512 bytes data]
* TLSv1.3 (IN), TLS handshake, Server hello (2):
{ [122 bytes data]
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
{ [19 bytes data]
* TLSv1.3 (IN), TLS handshake, Certificate (11):
{ [3631 bytes data]
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
{ [264 bytes data]
* TLSv1.3 (IN), TLS handshake, Finished (20):
{ [52 bytes data]
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
} [1 bytes data]
* TLSv1.3 (OUT), TLS handshake, Finished (20):
} [52 bytes data]
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN, server accepted to use h2
* Server certificate:
* subject: businessCategory=Private Organization; jurisdictionC=US; jurisdictionST=Delaware; serialNumber=3014267; C=US; ST=California; L=San Jose; O=PayPal, Inc.; CN=www.sandbox.paypal.com
* start date: Jun 2 00:00:00 2021 GMT
* expire date: Mar 2[Removed. Phone #s not permitted]GMT
* subjectAltName: host "api-m.sandbox.paypal.com" matched cert's "api-m.sandbox.paypal.com"
* issuer: C=US; O=DigiCert Inc; OU=www.digicert.com; CN=DigiCert SHA2 Extended Validation Server CA
* SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x25ebbea2d00)
} [5 bytes data]
> POST /v2/checkout/orders HTTP/2
> Host: api-m.sandbox.paypal.com
> user-agent: curl/7.77.0
> accept: */*
> content-type: application/json
> paypal-partner-attribution-id: FLAVORsb-7vgls6637891_MP
> authorization: Bearer A21AAIqLh0PtyEOBcKKjpE1BVdkOz9E67xUfC6-OdK12GAAotFGdM2zY7f9NFSAqvMsGFZrFjGp6F6VPxL1PhIVpIvM2arhEA
> content-length: 1151
>
{ [5 bytes data]
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
{ [193 bytes data]
* We are completely uploaded and fine
{ [5 bytes data]
< HTTP/2 401
< content-type: application/json
< server: nginx/1.14.0 (Ubuntu)
< cache-control: max-age=0, no-cache, no-store, must-revalidate
< paypal-debug-id: 9d6f16946f89e
< strict-transport-security: max-age=31536000; includeSubDomains
< edge-control: max-age=0
< accept-ranges: bytes
< date: Wed, 30 Jun 2021 14:40:51 GMT
< via: 1.1 varnish
< x-served-by: cache-hhn4036-HHN
< x-cache: MISS
< x-cache-hits: 0
< x-timer: S1625064051.232408,VS0,VE545
< content-length: 79
<
{ [5 bytes data]
100 1230 100 79 100 1151 128 1874 --:--:-- --:--:-- --:--:-- 2003{"error":"invalid_token","error_description":"Access Token not found in cache"}
* Connection #0 to host api-m.sandbox.paypal.com left intact

 

What did i do wrong? I'm currently using git bash for the curl commands

Login to Me Too
1 ACCEPTED SOLUTION

Accepted Solutions
Solved

StudiFH
Contributor
Contributor

Ok i figured out that my token was deprecated. But now i get "MALFORMED_REQUEST_JSON".

{"name":"INVALID_REQUEST","message":"Request is not well-formed, syntactically incorrect, or violates schema.","debug_id":"4b61a7e9166ea","details":[{"location":"body","issue":"MALFORMED_REQUEST_JSON"}],"links":[{"href":"https://developer.paypal.com/docs/api/orders/v2/#error-MALFORMED_REQUEST_JSON","rel":"information_link","encType":"application/json"}]}
* Connection #0 to host api-m.sandbox.paypal.com left intact.

I used the same Request as in the original post. Can anyone please help me find the mistake?

View solution in original post

Login to Me Too
1 REPLY 1
Solved

StudiFH
Contributor
Contributor

Ok i figured out that my token was deprecated. But now i get "MALFORMED_REQUEST_JSON".

{"name":"INVALID_REQUEST","message":"Request is not well-formed, syntactically incorrect, or violates schema.","debug_id":"4b61a7e9166ea","details":[{"location":"body","issue":"MALFORMED_REQUEST_JSON"}],"links":[{"href":"https://developer.paypal.com/docs/api/orders/v2/#error-MALFORMED_REQUEST_JSON","rel":"information_link","encType":"application/json"}]}
* Connection #0 to host api-m.sandbox.paypal.com left intact.

I used the same Request as in the original post. Can anyone please help me find the mistake?

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.