Test your integration
Test your Pay.com integration in the sandbox with test cards, simulate endpoints, and webhooks before going live.
Use the sandbox to validate every part of your integration before you
go live. Objects created in the sandbox include
"test_mode": true, and transactions never reach real banking networks.
Use your sandbox key and host
Send test requests to https://api.sandbox.pay.com/v1 with a sandbox key
(sk-pay-com-sandbox-). Sending a sandbox key to the live URL returns
401 Unauthorized. In the browser, Pay.com.js (the https://js.pay.com/v1
script, or @pay-com/js) works in the sandbox with a session you create there.
See Environments and
API keys.
For an end-to-end walkthrough, start with Create your first payment.
Test payment outcomes
Use test cards to simulate
approvals, declines, and 3D Secure challenges. Supply any future expiration
date and any 3-digit CVV (4 digits for American Express) except 777 and
999. CVV 777 declines the charge with decline_code: do_not_honour, and
999 with invalid_cvc.
Other flows use dedicated test values:
| To test | Use | See |
|---|---|---|
| A 3DS challenge on a charge | Card 5200000000001096, then challenge code 1234 (passes) or 3333 (fails) | Create a charge with 3DS |
| Standalone 3DS authentication | Dedicated test card, challenge codes, and frictionless failure | Standalone 3DS authentication |
| Partial approvals | Cards approved for 80% of the requested amount | Partial approvals |
| Payouts | Amounts 505 (fails immediately), 202 (succeeds later), and 303 (fails later) | Test and go live |
| Risk rules | Test charges matching the rule condition | Test your risk rules |
| Wallets and alternative payment methods | Method-specific sandbox values and test scenarios | The method's guide under Payment methods |
Simulate events after a payment
In live, clearing, disputes, collaborations, fraud warnings, and payout returns
arrive from banks, card networks, and processors, and subscriptions bill on a
schedule. In the sandbox, use simulate endpoints to trigger these events on
demand. Most simulate endpoints return 204 No Content without the object they
create, and all of them work only in the sandbox. In live, they return 403.
| To test | Call | What happens |
|---|---|---|
| Clearing a charge | POST /v1/charges/{transaction_id}/simulate/clear | Books simulated fees, clears the charge, creates a cashflow_transaction, and sends cashflow_transaction.created. See Simulate transaction clearing. |
| A dispute | POST /v1/charges/{transaction_id}/simulate/dispute or /simulate/dispute/{dispute_status} | Creates a dispute (open by default) or updates an existing dispute's status and sends the dispute webhook. See Simulate a dispute. |
| A collaboration | POST /v1/charges/{transaction_id}/simulate/collaboration | Creates an open collaboration from Mastercard Collaboration, Ethoca, or CDRN and sends collaboration.open. See Simulate a collaboration. |
| A fraud warning | POST /v1/charges/{transaction_id}/simulate/fraud_warning | Marks the charge as fraudulent and sends fraud_warning.created. See Simulate a fraud warning. |
| A payout return | POST /v1/payouts/{id}/simulate/return | Moves a succeeded payout to returned with code R01 and sends payout.returned. Can be called once per payout. |
| A subscription's next renewal | POST /v1/subscriptions/{subscription_id}/simulate/charge | Runs the next renewal immediately without waiting for the scheduled billing date, returns the subscription after it, and sends the renewal's events, such as subscription.charged. |
Test your webhooks
Register a sandbox webhook endpoint under Developers → Webhooks with a
public URL on your server and subscribe to the events you want to test. Verify
each event's Pay-Signature header with the endpoint's sandbox signing secret
(whsec-pay-com-sandbox-). See Webhooks and
Verify webhook signatures.
Inspect delivery attempts, payloads, and responses in the delivery log under
Developers → Webhooks, and resend missed events from there (see
Monitor webhook deliveries).
Pay.com retries failed deliveries every 15 minutes for up to 24 hours and can
deliver an event more than once, so verify that your handler deduplicates by
event id.
Next steps
Once your integration handles each test scenario, follow the Go live checklist.