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.

PANBrandProductScenarioExpected end statefailureReason.code
4242424242424242VisaConsumerSuccess (frictionless / challenge-approved)completednone
4000002760003184VisaConsumer3DS challenge required (no frictionless path)stripe-3ds → challenge → completednone
4000008400001629VisaConsumer3DS authentication failsfailedcanceled or rejected (see below)
4000000000000101VisaConsumerCVC check failsfailedincorrect_cvc
4000000000000002VisaConsumerGeneric declinefailedgeneric_decline
4000000000000069VisaConsumerExpired cardfailedexpired_card
4000000000009979VisaConsumerStolen card (hard decline)failedstolen_card
4000000000009995VisaConsumerInsufficient fundsfailedinsufficient_funds
4000000000009987VisaConsumerLost card (hard decline)failedlost_card
4000000000000119VisaConsumerProcessing error (transient)400 at create (stripe.try_again_later), no verification creatednone
4000000000000341VisaConsumerHIGHEST: verification hold declinesfailed at place-holds(hold decline)
4000000000003220VisaCommercial3DS challenge → successstripe-3ds → challenge → completednone
4000008400000027VisaConsumerTiered (MEDIUM, HIGH): 3DS challenge → success. No tier: challenge abandoned (below)stripe-3ds → challenge → completednone
4000008400001280VisaConsumerTiered: 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 → failedStripe's reason, passed through
5555555555554444MastercardConsumerFrictionless (issuer attests)MEDIUM/HIGH → completed; HIGHEST → two-hold flow → completednone
5200828282828210MastercardConsumer3DS challenge → successfingerprint → challenge → completednone
2223003122003222MastercardConsumer3DS challenge → authentication failsfailed (challenge POST → 403, verification.issuer_rejected)none
5105105105105100MastercardConsumer3DS challenge → abandonedfailed (challenge POST → 409)none
5200007840000022MastercardConsumer3DS challenge → the step failsfailed (challenge POST → 500, detail only, no errorCode)none
5555558265554449MastercardConsumerNetwork pre-check declined (rejected at create)400 at create, no verification creatednone
5200828282828897MastercardCommercialFrictionless (issuer attests)MEDIUM/HIGH → completed; HIGHEST → two-hold flow → completednone
5555552500001001MastercardCommercial3DS challenge → successfingerprint → challenge → completednone

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:

PANStepsExpected end statefailureReason
4242424242424242fingerprint only (frictionless)completednone
4000002760003184fingerprint → challengecompletednone
4000000000003220fingerprint → challengecompletednone
4000008400001629fingerprint → challengefailed (challenge POST → 403, verification.issuer_rejected)category: authentication_declined, code: "01"
4000008400000027fingerprint → challengefailed (challenge POST → 409: the cardholder abandoned the challenge)none
4000008400001280fingerprint → challengefailed (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.

  1. Create the card subscription: POST /card-subscriptions with the card and the consent record. The subscription starts in reqSCA, waiting for the verification.

  2. Create the verification: POST /card-verifications/3ds with a token for the test subaccount. CVC is required.

    { "pan": "4242424242424242", "expiryMonth": 12, "expiryYear": 2034, "cvc": "123", "cardholderName": "Sandbox Test", "subaccountId": "<SUBACCOUNT_ID>" }
  3. Branch on the response. When a challenge is required you get currentStepId: "stripe-3ds" with a clientSecret and a test-mode stripePublishableKey:

    {
      "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 returns state: "completed" directly (no stripe-3ds step).

  4. Complete the step: POST /card-verifications/3ds/{verificationId}/steps/stripe-callback after handleNextAction resolves, then GET /card-verifications/3ds/{verificationId} to read the final state.

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:

  1. Create a bank link with the API (Testing Bank Linking), or type an American Express test number in SDK v2 on a subaccount whose bankEnrollment includes American Express ("amex-only" or wider). Any number starting 34 or 37 routes 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.
  2. 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.
  3. Sign in with Plaid's public test login (username user_good, password pass_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: null and 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:

PANBrandOutcome without sandbox mode
4000 0000 0000 1117Visa3DS is skipped (test-card exemption) and resolves with authenticationFlow: null, not a challenge or frictionless pass
4242 4242 4242 4241VisaRejected as an invalid card number (its check digit is wrong); useful only to test your own card-number validation
5156 7637 1936 6465MastercardRejected as an invalid card number (its check digit is wrong); useful only to test your own card-number validation
5555 5555 5555 4444MastercardNetwork pre-check fails (rejected at create)
📘

Same card, two results

5555 5555 5555 4444 is 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 on

Plaid 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 false or null to 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


Did this page help you?