Testing

Try every SDK v2 route in sandbox with test cards on an admin page and an employee page, then test transactions, webhooks and bulk feeds past enrollment.

For: developers

The Quick Start tries one subaccount policy on an admin page. This page tries every route: three policies, on an admin page and an employee page.

Try every route in sandbox

Sandbox is the same SDK against the sandbox API, so getAccessToken must return a token minted with your sandbox credentials (self sign-up at astrada.co/sandbox).

  1. Check your SDK client's bulk scope. The bulk kickoff and the confirm request need network-bulk-enrollments:write or network-bulk-feeds:write on the token your backend passes to the SDK. A self sign-up sandbox client already holds network-bulk-feeds:write. A sandbox client Astrada made for you may hold neither; without either, those calls answer 403 (see Token scopes), so ask your Astrada contact to add one. Tokens minted after that carry it.

  2. Prepare a test subaccount as in Quick Start step 2: create it with Visa and Mastercard in its configurations, then PATCH its verificationPolicy and enrollmentPolicy. That call lets frictionless test cards verify without a challenge (MEDIUM, explained in Verification Risk Tiers), and sets policy A from the table below. The subaccount's enrollmentPolicy wins field by field over what open() passes (see Which value wins), so set all three enrollmentPolicy fields. Allow up to 60 seconds before you open a bank link (see Bank linking in sandbox).

  3. Open a session on your test page from the sandbox host, as in Open a session. Set persona to "admin" for the admin rows below and "cardholder" for the employee rows. To try a session without writing a page, use the SDK playground: its presets set persona and the three enrollment options, and show the open() call they produce.

  4. Drive each route with a test card. On an admin page, type the number on the card number screen and press Continue (it needs 8 digits). On an employee page, type it on the card form: the SDK routes the card once 8 digits are typed.

    The tests use three subaccount policies; switch between them with the same PATCH, changing only enrollmentPolicy:

    PolicyenrollmentPolicy
    Acard true, bank "amex-only", bulk "suggested"
    Bcard true, bank "off", bulk "suggested"
    Ccard true, bank "off", bulk "off"
    Type this (policy, page)What you seeroute in route-decided
    Any number starting 34 or 37 (B, admin)The program screen for an American Express program. Connect all company cards opens the kickoff form, which ends on "Request sent" or "Next: write to your bank" and sends bulk-enrollment-requested.amex-kickoff
    5555 5511, then Continue (A, admin)The program screen with Connect all company cards and This doesn't look right. The kickoff ends on "Request sent" or "Next: write to your bank", with Connect this card now.proven-single
    5555 5522, then Continue (A, admin)The callout "You may be able to connect all your cards at once", with Ask Astrada to check and Connect this card now. Sending the request fires bulk-confirmation-requested.high-single
    Any number starting 34 or 37 (A, admin or employee)The Amex bank screen (on an employee page, once the card form has the first 8 digits), then the Plaid window (First Platypus Bank in sandbox). Sign in with user_good / pass_good and pick the credit card account. You get bank-linked, then card-enrolled with enrollmentType: "bank-feed".amex-bank
    4242 4242 4242 4242, expiry 12/34, CVC 123 (A, admin or employee)On an admin page, the card form with the first digits filled in; on an employee page, the card form you are typing in stays open. The card verifies without a challenge and sends card-enrolled.card-only (admin), cardholder-card (employee)
    5555 5525 0000 1001, any future expiry, CVC 123 (A, admin)The card form, a 3DS challenge, then success and card-enrolled.card-only
    Any number starting 34 or 37 (C, admin)"This card can't be connected here".amex-not-eligible
    Any number starting 34 or 37 (B or C, employee)Once the card form has the first 8 digits, "Your company connects this card", and company-connection-needed.cardholder-company-connects

    About the kickoff rows: the kickoff ends on "Request sent" when Astrada contacts the bank, or on "Next: write to your bank" when the admin contacts it. Once your account has a kickoff open for the program, 5555 5511 opens "Already under way" instead.

    5555 5511 and 5555 5522 exist only to show these screens in sandbox. They are not full test cards, so a card started from them can't finish the card form: sandbox enrolls only the published test cards. In sandbox, kickoffs and confirm requests never reach a bank or a card network.

  5. Run it again. Each test card enrolls once per subaccount: enrolling it again reports the existing card with alreadyEnrolled: true. For a fresh run, delete the subaccount and create another.

Testing beyond the SDK

The SDK stops at enrollment. To test what your platform does next, carry on in sandbox:

  • Transactions. Run a predefined transaction lifecycle against an enrolled card with POST /simulate/transaction/scenario, or publish one message at a time with POST /simulate/transactions. Both need simulation:write, which sandbox clients have by default, and POST /simulate/transactions also needs cards:read. See Sandbox API Reference.
  • Webhooks. Register a webhook on the test subaccount, as in Testing Single Card Enrollment, to receive cardsubscription.created for each card the SDK enrolls and the transaction events that follow.
  • Bulk feeds. To watch a feed deliver cards and transactions, create one with your API client and simulate a delivery of its cards, as in Testing Bulk Enrollment.

Did this page help you?