PayPal Sandbox negative testing of subscriptions w

2019-05-06 21:51发布

问题:

I have been working with a team to provide PayPal integration for our application, and our implementation using the REST API to set up subscriptions is going well. I'm having problems, however, trying to test some negative scenarios such as a user having an expired card. I notice that negative testing can be enabled in the sandbox environment, but I believe this only works for the Classic API (we are using the REST API).

Is there any way I can set up a test user with an expired card, or a test user that has no money in their bank (not PayPal) account etc etc. I want to understand the behaviour of the approval and execute stages of setting up a subscription more thoroughly and what errors can be handled by our application at each stage.

Thanks

回答1:

Negative Testing is not completely supported for REST APIs at this time. However, you can use the Negative Testing for Express Checkout with REST to simulate some of the errors. For exmaple, if you'd like to recreate INSTRUMENT_DECLINED then do the negative testing for decline with Express Checkout.