Test and go live
Test payout outcomes and returns in the sandbox, then check your integration before your first live payout.
Build and test your payouts in the sandbox, at https://api.sandbox.pay.com/v1 with your sk-pay-com-sandbox- key. Sandbox payouts never move real money. Then go through the checklist before your first live payout.
Get a sandbox destination
A sandbox payout can go to a saved test card, test card details, or a Plaid sandbox bank account.
- A saved card. Complete a payout setup session with Universal checkout using a test card such as
4242424242424242, then pay out to the savedpm_card_…ID. - Card details. Send a test card in
destination_data, if your key is PCI compliant. - A US bank account. Link one of Plaid's sandbox accounts. See US bank account.
Test outcomes
For a card or bank account destination, the payout's amount sets its outcome in the sandbox:
amount | Outcome |
|---|---|
505 | The payout fails immediately. The response is 400 with error.type: payment_method_error and the payout's ID in error.payout, and the payout is failed. |
202 | The response has status: pending. Then the payout succeeds, and Pay.com sends payout.succeeded. |
303 | The response has status: pending. Then the payout fails, and Pay.com sends payout.failed. |
Simulate a return
To test how you handle a return, simulate one on a succeeded payout with POST /v1/payouts/{id}/simulate/return.
curl -X POST https://api.sandbox.pay.com/v1/payouts/po_687092287729042432/simulate/return \
-u ':sk-pay-com-sandbox-…'The response is 204 No Content. The payout's status becomes returned, with return code R01, and Pay.com sends payout.returned. A payout can be returned only once (a second call returns 400), and only after it succeeded (422 otherwise). In the live environment, the endpoint returns 403.
Go-live checklist
Before your first live payout, verify each item below along with the server Go live checklist (switching to https://api.pay.com/v1, a live API key, and your live webhook signing secret).
- Payout methods. Confirm your account manager enabled each payout method in the live environment.
GET /v1/merchants/current/payment_method_optionslists enabled types inpayout_method_options.types. - Your key. If you send card, wallet, or bank account details in
destination_data, use a live PCI compliant key. - Webhooks. Configure your live endpoint to receive
payout.pending,payout.succeeded,payout.failed, andpayout.returned, verify each event's signature, and skip duplicate events. - Idempotency keys. Send a unique
idempotency-keyon everyPOST /v1/payoutsrequest, and reuse the same key when retrying. - Funding. Payouts draw from the balance of the settlement account they're routed to. If your balance can't cover a payout, it remains
pendinguntil funds arrive. For bank payouts, setbalance_failure_on_create: trueto fail immediately withinsufficient_fundsinstead. See Balances and cash flow.
Next steps
- Create a payout: Send payouts from your server with
POST /v1/payouts. - Track and manage payouts: Monitor payout statuses, webhooks, cancellations, and bank returns.