Sandbox & test cards
Run end-to-end tests against a risk-free sandbox environment
Sandbox vs production
Environment selection is driven by the API key prefix — there is no separate sandbox host:
| API key prefix | Environment | PSP connection |
|---|---|---|
sk_test_... | Sandbox | Simulated PSP (no real charges) |
sk_live_... | Production | Real acquirer |
Both prefixes hit the same base URL (https://api.settleflow.io). Always make sure the right key reaches the right environment in your deployment pipeline.
Test cards
SettleFlow's sandbox recognises these card numbers. Use any valid future expiry date (e.g. 12 / 2028) and any 3-digit CVV unless noted.
| Card number | Behaviour |
|---|---|
4111111111111111 | Direct authorize + capture, no 3DS challenge. |
4000000000003220 | Forces a 3DS2 challenge — response contains 3DSecureUrl. |
More test cards for specific edge cases (declines, insufficient funds, soft declines) can be requested from your SettleFlow account manager.
What the sandbox simulates
- Luhn validation (same as production).
- 3DS challenge redirect flow — the
3DSecureUrlpoints at a simulated ACS page. - Webhook delivery with signed payloads (same HMAC scheme as production, using your sandbox webhook secret).
- Refund and status endpoints against sandbox transactions.
What the sandbox does not simulate:
- Real card network authorization latency (responses are faster than production).
- Dynamic chargeback / dispute flows — these must be staged by SettleFlow support.
- Bank-level decline reasons that depend on the issuing bank.
Typical testing checklist
Before switching to production, confirm the following all succeed in sandbox:
- Auth + capture without 3DS —
POST /v1/payment/directwith4111111111111111returnsStatus: capturedandCode: 0. - 3DS challenge —
POST /v1/payment/directwith4000000000003220and3DS: "yes"returns3DSecureUrl; after redirect,/v1/status/directreportscaptured. - Webhook signature — a webhook hits your
CallbackUrl, signature verifies successfully with yourwhsec_...sandbox secret (see Webhooks). - Refund —
/v1/refund/directon the captured transaction returnsStatus: captured,OperationType: refund. - Status lookup by
Tid—/v1/status/directwith your ownTidreturns the same transaction as when queried byReference. - Error handling — a malformed request produces the expected numeric
Code(e.g.206for an invalid card number). See Error codes.
Going live
Once the checklist passes, the cutover is simple:
- Replace the
sk_test_key with yoursk_live_key in environment configuration. - Replace the sandbox
whsec_secret with the production one. - Point
CallbackUrlandReturnUrlat production URLs (HTTPS required). - Run a single low-value transaction on a real card and reconcile it in the SettleFlow merchant dashboard.
- Monitor the first production webhook deliveries to confirm signatures verify with the live secret.