Test Cards & Sandbox Testing
Test card numbers with fixed 3DS, decline and two-hold outcomes in the sandbox environment, and sandbox mode: a per-subaccount flag on the production API for verification tests.
For: developers
Introduction
In the sandbox environment every subaccount uses the test cards on this page. Set a risk tier on the subaccount first (Testing Single Card Enrollment, step 1): without one, the decline, CVC and stolen-card test cards connect like a good card (Visa on a subaccount with no tier). Each card fixes its verification outcome (success, 3DS challenge, a decline, or the HIGHEST two-hold flow), so you choose the path you want to test by choosing the card. No real money moves.
The same cards also work on the production API, on a subaccount you flag for it. That is sandbox mode, covered in Sandbox mode on production at the end of this page. If you are testing in the sandbox environment, you can skip that section.
Only test cards enroll in the sandbox environment
In the sandbox environment, card enrollment accepts only the published test cards in the matrix below. Submitting any other card number (PAN, the full card number) to POST /card-subscriptions is rejected up front, before any network call, with a typed 403:
{
"title": "Card cannot be enrolled",
"detail": "This card is not a sandbox test card. In the sandbox environment, only published Astrada test cards can be enrolled. Use a card from the sandbox test-card list: https://docs.astrada.co/docs/sandbox-testing",
"errorCode": "card_subscription.sandbox_card_not_allowed",
"type": "https://docs.astrada.co/reference/errors-sandbox_card_not_allowed"
}This keeps real card numbers out of the sandbox and turns what used to be a silent failure later on into a clear error at the door. The allowlist is matched on the full card number exactly (never a BIN, the first digits that identify the card's bank, or any other prefix). This rule is separate from sandbox mode: sandbox mode controls how a card is verified on the production API; this rule controls which cards may be enrolled at all in the sandbox environment. See Sandbox API Reference for that environment's other endpoints (transaction simulation, network bulk-feed simulation).
Sandbox test-card matrix
These are the fixed outcomes, verified against the verification sandbox. All cards use any future expiry (for example 12/2034) and any 3-digit CVC (123) unless the row is about CVC.
The Product column is the card type the sandbox reports to the enrollment card-type control (blockedCardTypes): a subaccount that blocks CONSUMER cards rejects every consumer card below and accepts a COMMERCIAL one, so you can test a consumer-card block end to end.
| PAN | Brand | Product | Scenario | Expected end state | failureReason.code |
|---|---|---|---|---|---|
4242424242424242 | Visa | Consumer | Success (frictionless / challenge-approved) | completed | none |
4000002760003184 | Visa | Consumer | 3DS challenge required (no frictionless path) | stripe-3ds → challenge → completed | none |
4000008400001629 | Visa | Consumer | 3DS authentication fails | failed | canceled or rejected (see below) |
4000000000000101 | Visa | Consumer | CVC check fails | failed | incorrect_cvc |
4000000000000002 | Visa | Consumer | Generic decline | failed | generic_decline |
4000000000000069 | Visa | Consumer | Expired card | failed | expired_card |
4000000000009979 | Visa | Consumer | Stolen card (hard decline) | failed | stolen_card |
4000000000009995 | Visa | Consumer | Insufficient funds | failed | insufficient_funds |
4000000000009987 | Visa | Consumer | Lost card (hard decline) | failed | lost_card |
4000000000000119 | Visa | Consumer | Processing error (transient) | 400 at create (stripe.try_again_later), no verification created | none |
4000000000000341 | Visa | Consumer | HIGHEST: verification hold declines | failed at place-holds | (hold decline) |
4000000000003220 | Visa | Commercial | 3DS challenge → success | stripe-3ds → challenge → completed | none |
4000008400000027 | Visa | Consumer | Tiered (MEDIUM, HIGH): 3DS challenge → success. No tier: challenge abandoned (below) | stripe-3ds → challenge → completed | none |
4000008400001280 | Visa | Consumer | Tiered: at MEDIUM 3DS fails with an error, at HIGH the card is declined; neither shows a challenge. No tier: challenge step 500 (below) | stripe-3ds → failed | Stripe's reason, passed through |
5555555555554444 | Mastercard | Consumer | Frictionless (issuer attests) | MEDIUM/HIGH → completed; HIGHEST → two-hold flow → completed | none |
5200828282828210 | Mastercard | Consumer | 3DS challenge → success | fingerprint → challenge → completed | none |
2223003122003222 | Mastercard | Consumer | 3DS challenge → authentication fails | failed (challenge POST → 403, verification.issuer_rejected) | none |
5105105105105100 | Mastercard | Consumer | 3DS challenge → abandoned | failed (challenge POST → 409) | none |
5200007840000022 | Mastercard | Consumer | 3DS challenge → the step fails | failed (challenge POST → 500, detail only, no errorCode) | none |
5555558265554449 | Mastercard | Consumer | Network pre-check declined (rejected at create) | 400 at create, no verification created | none |
5200828282828897 | Mastercard | Commercial | Frictionless (issuer attests) | MEDIUM/HIGH → completed; HIGHEST → two-hold flow → completed | none |
5555552500001001 | Mastercard | Commercial | 3DS challenge → success | fingerprint → challenge → completed | none |
failureReason.code holds different code sets depending on how the card was verified: for Stripe-routed failures like these it is Stripe's decline code shown above; for network 3DS failures elsewhere it carries a 3DS transStatusReason code. Check failureReason.category first if you branch on the kind of failure.
4000 0084 0000 1629 fails at the 3DS step when you choose Fail on Stripe's test page. The failureReason is the 3DS result Stripe's test mode reports: either canceled (category: authentication_canceled) or rejected (category: authentication_declined). Treat both as a failed authentication.
Under HIGH the issuer is always asked to challenge, so most Visa cards first return currentStepId: "stripe-3ds" and require the 3DS step before reaching the final state; under MEDIUM the issuer decides, so frictionless-capable cards (like 4242…4242) complete without a challenge step. Stolen, lost and fraudulent cards hard-decline at every tier. No tier lets them through. Each tier is explained in Verification Risk Tiers.
Mastercard test cards. Astrada answers for Mastercard test cards itself: the live Mastercard network is never called, and the test card fixes the outcome. A challenge card returns currentStepId: "fingerprint", then "challenge". In the sandbox environment both steps point at mock issuer pages, so you can run the browser flow from the direct API guide as written. The fingerprint step's threeDSMethodURL loads a hidden 3DS Method page, and the challenge step's acsUrl is a test challenge page with Complete authentication and Fail authentication buttons. The pages send the usual threeds-method-notification and threeds-challenge-notification messages to your page. Either button returns the result the test card is set to.
At HIGHEST, a frictionless Mastercard card (5555…) takes the two-hold path; a passed challenge completes with no holds.
Visa on a subaccount with no tier
The Visa rows above assume the subaccount has a stripeValidationLevel (Verification Risk Tiers). With no tier set, Visa runs the card network's own 3DS steps (fingerprint, then challenge) instead of stripe-3ds. In the sandbox environment six Visa test cards are emulated on that path, with the same mock issuer pages:
| PAN | Steps | Expected end state | failureReason |
|---|---|---|---|
4242424242424242 | fingerprint only (frictionless) | completed | none |
4000002760003184 | fingerprint → challenge | completed | none |
4000000000003220 | fingerprint → challenge | completed | none |
4000008400001629 | fingerprint → challenge | failed (challenge POST → 403, verification.issuer_rejected) | category: authentication_declined, code: "01" |
4000008400000027 | fingerprint → challenge | failed (challenge POST → 409: the cardholder abandoned the challenge) | none |
4000008400001280 | fingerprint → challenge | failed (challenge POST → 500, detail only, no errorCode) | none |
The last two reproduce the two challenge failures that have no Stripe equivalent; with a tier set they run Stripe's test 3DS like the other Visa cards (see the matrix). This emulation exists only in the sandbox environment and only for these six cards. To test Visa declines, or Visa on the production API, set a tier.
Attempt lockout
Test cards count toward the verification attempt lockout like real cards. With failedAttemptLockout on, a test card you fail repeatedly, such as 2223 0031 2200 3222, or (with no tier) 4000 0084 0000 1629, locks after five failures within an hour. An abandoned challenge (5105 1051 0510 5100, or 4000 0084 0000 0027 with no tier) does not count, and neither does a challenge step that fails with 500 (5200 0078 4000 0022, or 4000 0084 0000 1280 with no tier). For 4000 0084 0000 1280, this applies only with no tier; its tiered failure is a different path.
Call sequence
Point the SDK at the test subaccount and it drives this whole sequence for you. The raw steps below are for direct or automated API testing; Testing Single Card Enrollment shows each request and response in full.
-
Create the card subscription:
POST /card-subscriptionswith the card and the consent record. The subscription starts inreqSCA, waiting for the verification. -
Create the verification:
POST /card-verifications/3dswith a token for the test subaccount. CVC is required.{ "pan": "4242424242424242", "expiryMonth": 12, "expiryYear": 2034, "cvc": "123", "cardholderName": "Sandbox Test", "subaccountId": "<SUBACCOUNT_ID>" } -
Branch on the response. When a challenge is required you get
currentStepId: "stripe-3ds"with aclientSecretand a test-modestripePublishableKey:{ "id": "…", "currentStepId": "stripe-3ds", "state": "in-progress", "clientSecret": "seti_…_secret_…", "stripePublishableKey": "pk_test_…" }Load Stripe.js with that publishable key and call
stripe.handleNextAction({ clientSecret }). A frictionless success returnsstate: "completed"directly (nostripe-3dsstep). -
Complete the step:
POST /card-verifications/3ds/{verificationId}/steps/stripe-callbackafterhandleNextActionresolves, thenGET /card-verifications/3ds/{verificationId}to read the finalstate.
The verification response includes authenticationFlow (frictionless, challenge, or null if 3DS didn't run) so you can tell a frictionless approval from a completed challenge.
Testing the HIGHEST two-hold flow
A test card has no banking app to read the hold amounts from, so on a sandbox verification the place-holds response includes the amounts:
{ "currentStepId": "stripe-amount-confirm", "sandboxHoldAmounts": { "amount1": 57, "amount2": 88 } }sandboxHoldAmounts is test-mode only, never present on a live verification, and never on GET. Feed the two values straight into POST /steps/amount-confirm to drive the success path. See HIGHEST Verification for the full flow.
Bank linking in sandbox
In the sandbox environment every bank link uses Plaid Sandbox, Plaid's test environment, with nothing to set. On the production API, the sandbox mode flag does the same for a test subaccount (below).
To drive it:
- Create a bank link with the API (Testing Bank Linking), or type an American Express test number in SDK v2 on a subaccount whose
bankEnrollmentincludes American Express ("amex-only"or wider). Any number starting34or37routes to the bank step once 8 digits are in: on an admin page when you press Continue, on an employee page as you type. SDK v2 treats every number starting with 3 as American Express, so a Diners Club or JCB number takes the same route. - In the Plaid window, pick First Platypus Bank. Plaid Sandbox has no American Express sign-in that completes, so on a sandbox link limited to American Express, First Platypus Bank stands in for it.
- Sign in with Plaid's public test login (username
user_good, passwordpass_good) and select the credit-card account.
Completing the link behaves exactly like a live bank enrollment: a bank-linked SDK event with the connection, a card-enrolled SDK event per created card with enrollmentType: "bank-feed" (in sandbox the card comes from First Platypus Bank, so it does not carry the amex network), a cardsubscription.created webhook per created card (you receive it only if your webhook subscribes to it: see Creating webhooks), and test transactions on sync.
Sandbox mode on production
Sandbox mode runs the test cards above through card verification on the production API, deterministically and with no real money moving. You turn it on per subaccount. You do not need it in the sandbox environment, where test-card routing is always on.
How it works
On a sandbox-enabled subaccount, the verification service routes by card number:
- A known test card (the matrix above) runs against the verification sandbox (test mode): you get real 3DS and decline behaviour, deterministically.
- Any other card runs against live processing, exactly as in production.
Only a literal true turns it on, and it matches the full card number exactly (never a BIN or prefix). If the flag is missing or holds anything else, a test card is not diverted: it goes to the real network like any other card. What happens to a Visa test card there depends on the tier:
- With a tier set, it goes to live processing and is declined as invalid.
- With no tier set, Visa runs the card network's own 3DS, which does not recognise the test card, so 3DS is skipped. The verification completes with
authenticationFlow: nulland the card enrolls, even for a card the matrix lists as a decline (4000 0000 0000 0002, for example). If your subaccount is set to require 3DS, the verification is refused instead.
Sandbox mode applies to every tier, including HIGHEST: the two-hold flow runs as test-mode authorizations, so you can drive it end to end.
Sandbox mode does not emulate Visa with no tier. On the production API, sandbox mode sends Visa test cards to the verification sandbox only on the tiered path. The six no-tier Visa cards above are emulated in the sandbox environment only; on production, a Visa test card on a subaccount with no tier behaves as described in the list above, flag or not. To test the network 3DS path on production, use the Mastercard test cards, which run the same steps and return the same errors: 2223 0031 2200 3222 (challenge fails, 403 verification.issuer_rejected), 5105 1051 0510 5100 (challenge abandoned, 409) and 5200 0078 4000 0022 (challenge step fails, 500).
On a sandbox-mode subaccount, Mastercard challenge steps are simulated: there is no issuer challenge screen to render. Advance the steps with POST /steps/fingerprint and POST /steps/challenge.
Enabling sandbox mode
Set sandbox on the subaccount's verificationPolicy via Update Subaccount:
PATCH /subaccounts/{subaccountId} HTTP/1.1
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json
{
"verificationPolicy": { "sandbox": true }
}curl -X PATCH https://api.astrada.co/subaccounts/{subaccountId} \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"verificationPolicy": { "sandbox": true }
}'{
"verificationPolicy": { "sandbox": true }
}Use a dedicated test subaccount, never one that holds real cards. Coordinate with your Astrada contact to set one up. Anything other than true (absent, false, null) means live processing. You still call the production API with a token for the test subaccount.
The only difference in a sandbox-mode verification is that the returned stripePublishableKey is the test-mode key, so the SDK runs the challenge against Stripe's test environment. Endpoints and request and response shapes are otherwise identical to production.
Without sandbox mode
On a production subaccount without the flag, cards go to the real networks (Visa and Mastercard), exactly as in production. A few network test cards behave predictably there:
| PAN | Brand | Outcome without sandbox mode |
|---|---|---|
4000 0000 0000 1117 | Visa | 3DS is skipped (test-card exemption) and resolves with authenticationFlow: null, not a challenge or frictionless pass |
4242 4242 4242 4241 | Visa | Rejected as an invalid card number (its check digit is wrong); useful only to test your own card-number validation |
5156 7637 1936 6465 | Mastercard | Rejected as an invalid card number (its check digit is wrong); useful only to test your own card-number validation |
5555 5555 5555 4444 | Mastercard | Network pre-check fails (rejected at create) |
Same card, two results
5555 5555 5555 4444is rejected at create (network pre-check failure) without sandbox mode, but on a sandbox-enabled subaccount the sandbox returns a frictionless success for it (see the matrix above).
Bank linking with sandbox mode
On a sandbox-enabled subaccount (verificationPolicy.sandbox: true) on the production API, new bank links are created against Plaid Sandbox instead of production Plaid. Only a literal true does this; anything else means production bank linking. Drive it the same way as Bank linking in sandbox.
Real bank credentials don't work while the flag is onPlaid Sandbox accepts only Plaid's test logins, so a real bank sign-in always fails on a sandbox-enabled subaccount. Set the flag back to
falseornullto test production bank linking.
Flag changes take up to 60 seconds to reach bank linking. Existing links keep the environment they were created in: a sandbox link stays sandbox until it is deleted, whatever later changes you make to the flag.
Next steps
- SDK v2: Quick Start. The integration from first page to enrolled card.
- Verification Risk Tiers. What each tier does.
- Error States & Remediation. Reproduce and handle every failure path with the matrix above.
Updated about 17 hours ago
