Simulate negative responses with test values
Last updated: Sept 19th, 5:00pm
You can use the test values-based method to test these APIs:
Set up your development environment
Before you can use test values to simulate negative responses, you must set up your development environment. After you get a token that lets you access protected REST API resources, you create sandbox accounts to test your web and mobile apps. For details, see Get started.
Then, return to this page to use test values to simulate negative responses.
Invoke negative testing
1. | Set the test values in the request field. |
2. | Send your request to the endpoint you'd like to test. |
Example request
To trigger the SENDER_EMAIL_UNCONFIRMED
simulation response, set the items[0]/note
value to ERRPYO002
in the POST
v1/payments/payouts call.
1curl -X POST https://api-m.sandbox.paypal.com/v1/payments/payouts \2-H "content-type: application/json" \3-H "Authorization: Bearer <Access-Token>" \4-d '{5"sender_batch_header": {6 "sender_batch_id": "1524086406556",7 "email_subject": "This email is related to simulation"8},9"items": [10{11 "recipient_type": "EMAIL",12 "receiver": "payouts-simulator-receiver@paypal.com",13 "note": "ERRPYO002",14 "sender_item_id": "15240864065560",15 "amount": {16 "currency": "USD",17 "value": "1.00"18 }19}]20}'
Example response
1{2"name": "SENDER_EMAIL_UNCONFIRMED",3"message": "Authorization error occurred",4"debug_id": "ca787bdf80d7a",5"information_link": "/docs/api/payments.payouts-batch/v1/#errors"6}
For negative case payouts test codes, see test values.