Skip to Content
Docs

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.

If duplicate card checking is enabled on your sandbox account, reusing a test card returns decline_code: duplicate_card. Pass duplicate_card_check: false in payment_method_options.card on sandbox charges, holds, or payment sessions, and remove it before going live.

Other flows use dedicated test values:

To testUseSee
A 3DS challenge on a chargeCard 5200000000001096, then challenge code 1234 (passes) or 3333 (fails)Create a charge with 3DS
Standalone 3DS authenticationDedicated test card, challenge codes, and frictionless failureStandalone 3DS authentication
Partial approvalsCards approved for 80% of the requested amountPartial approvals
PayoutsAmounts 505 (fails immediately), 202 (succeeds later), and 303 (fails later)Test and go live
Risk rulesTest charges matching the rule conditionTest your risk rules
Wallets and alternative payment methodsMethod-specific sandbox values and test scenariosThe 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 testCallWhat happens
Clearing a chargePOST /v1/charges/{transaction_id}/simulate/clearBooks simulated fees, clears the charge, creates a cashflow_transaction, and sends cashflow_transaction.created. See Simulate transaction clearing.
A disputePOST /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 collaborationPOST /v1/charges/{transaction_id}/simulate/collaborationCreates an open collaboration from Mastercard Collaboration, Ethoca, or CDRN and sends collaboration.open. See Simulate a collaboration.
A fraud warningPOST /v1/charges/{transaction_id}/simulate/fraud_warningMarks the charge as fraudulent and sends fraud_warning.created. See Simulate a fraud warning.
A payout returnPOST /v1/payouts/{id}/simulate/returnMoves a succeeded payout to returned with code R01 and sends payout.returned. Can be called once per payout.
A subscription's next renewalPOST /v1/subscriptions/{subscription_id}/simulate/chargeRuns 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.

Was this page helpful?