REST API issues in sandbox

matt-james
Contributor
Contributor

I'm trying to get my solution working so that I can have customers enter their credit card and then I can reuse that card later for purchases in our platform using PayPal to process the transaction.

My issues started yesterday when I was working on running some end-to-end tests on the process.  All of this is done with sandbox endpoints, my account in sandbox mode and with sandbox API credentials.

  • I was able to create a new card and save it in my vault.  I created [removed]and got the setup token back.
  • When I went to use the card, I was able to get the payment token for my card, but I got a 500 error when trying to complete the purchase with no details regarding what had gone wrong.
  • I found some posts saying that certain cards can get into a bad state within PayPal servers, so they recommended using a real card.  I did that, and was again able to get the setup token.  However, when I went to use it, I got the payment token, but a 403 error when trying to complete the purchase.  Again, no details to help with the nature of the error.
  • Digging some more, I found the Card Testing page in the documentation, so I generated card details from there and tried those.  I got the same results as the real card.
  • When looking at the API logs, I noticed that both my /v3/vault/payment-tokens and /v2/checkout/orders had the same debug ID.  Which made me wonder if it didn't like the fact that I was reusing my bearer token for all of the calls in an operation (getting the token and placing the order).  So, I made changes to get a new bearer token for each and every call - no change.
  • Now, this morning, I came in to post this, but I hadn't apparently finished setting up my account.  So, I went through that process.  When I got back to the developer dashboard and tried to gather information for this post, all of my API history was gone.  And, my API credentials had changed.  I've re-run my tests this morning (with a new card created under new API credentials) and I'm still getting a 403.

Here's the body of the call that I'm making for the purchase (minus the actual token id):

{"intent":"CAPTURE","purchase_units":[{"amount":{"currency_code":"USD","value":"250.00"}}],"payment_source":{"card":{"vault_id":"XXXXXXXXXXXXX"},"stored_credential":{"payment_initiator":"MERCHANT","payment_type":"RECURRING","usage":"SUBSEQUENT"}}}

 

Any ideas?  Things that I may be missing based on the examples shown at https://developer.paypal.com/docs/checkout/save-payment-methods/purchase-later/payment-tokens-api/ca...  Or in my account?  It seems like my credentials and base REST mechanism are working properly, so I don't know where in the details I'm having issues.

 

Thanks,

Matt

Login to Me Too
1 REPLY 1

Kavyar
Moderator
Moderator

Good day @matt-james 

 

Thank you for posting to the PayPal community.

 

I would suggest to please contact your website developer (or) the third party eCommerce support to cross check your using same SANDBOX/LIVE REST API Credentials(Client ID & Secret) while performing the below API calls.

 

https://developer.paypal.com/api/rest/authentication/

https://developer.paypal.com/api/rest/postman/ 

 

Important: Please note that it is important to utilize the token within 24 hours. If it is not used within this timeframe, you will need to generate a new token.

 

Also, If a third-party eCommerce partner is performing API operation on your behalf, you(i.e. merchant) should be on-boarded and necessary API permissions should be granted to the Partner(API Caller). 

 

https://developer.paypal.com/docs/multiparty/ 

 

https://developer.paypal.com/docs/multiparty/seller-onboarding/ 

 

Merchants can manually grant permission to a third-party eCommerce to access specific information in your PayPal account and perform PayPal API operations on your behalf.

 

Login PayPal.com >> Settings >> Account Settings >> Website payments >> API Access >> Pre-built payment solution >> Grant API permission >> contact your "Third party software eCommerce" for Third Party Permission Username >> enter the username.

 

Direct link -  https://www.paypal.com/cgi-bin/webscr?cmd=_profile-api-grant-authorization

                       https://developer.paypal.com/api/nvp-soap/paypal-payments-standard/admin/third-party/ 

 

If your still facing issues, please create an MTS ticket via -  https://www.paypal-support.com/s/?language=en_US  with the detailed information and error details.

 

Sincerely,

Kavya

PayPal MTS

 

If this post or any other was helpful, please enrich the community by giving kudos or accepting it as a solution.

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.