Testing Single Card Enrollment
Enroll a published test card in the sandbox environment with the SDK or API, watch 3DS verification complete, check webhooks, then simulate a transaction.
For: developers
Introduction
This guide walks single-card enrollment end to end in the sandbox environment: create a subaccount, enroll a published test card with SDK v2, watch the 3DS verification complete, read the resources it created, then simulate a transaction on the card. Every request runs against https://api.sandbox.astrada.co with a bearer token from Get a token. The flow is identical to production; only the issuer behind the 3DS step is simulated, so each test card produces the same outcome every time.
Only published test cards can be enrolled here. The full list, with the outcome each card produces, is in Test Cards & Sandbox Testing.
Try it without writing codeThe SDK v2 playground opens SDK v2 on its own page. Enter your sandbox account id, client id and client secret, put your subaccount id in the
open()call it shows, press Open SDK, and enroll any card from the test-card list. It runs the same flow as step 3, so you can see the outcomes before writing a line of code.

The SDK v2 playground. Your sandbox values go in the three boxes; your subaccount id goes in the open() call.
1. Create a subaccount, set its verification tier, register a webhook
Create a fresh subaccount for the test run, so cleanup is trivial and events are easy to attribute:
POST /subaccounts HTTP/1.1
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json
{
"name": "card-enrollment-test",
"configurations": {
"VISA": { "countries": "*" },
"MASTERCARD": { "countries": "*" }
}
}curl -X POST https://api.sandbox.astrada.co/subaccounts \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "card-enrollment-test",
"configurations": {
"VISA": { "countries": "*" },
"MASTERCARD": { "countries": "*" }
}
}'{
"name": "card-enrollment-test",
"configurations": {
"VISA": { "countries": "*" },
"MASTERCARD": { "countries": "*" }
}
}Response (201 Created): the subaccount; keep its id as {subaccountId} for everything below.
Then set the subaccount's verification tier. stripeValidationLevel picks the risk tier the verification runs at (MEDIUM is the usual starting point; see Verification Risk Tiers). Test cards route to the simulated issuer automatically in the sandbox environment:
PATCH /subaccounts/{subaccountId} HTTP/1.1
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json
{ "verificationPolicy": { "stripeValidationLevel": "MEDIUM" } }curl -X PATCH https://api.sandbox.astrada.co/subaccounts/{subaccountId} \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "verificationPolicy": { "stripeValidationLevel": "MEDIUM" } }'{ "verificationPolicy": { "stripeValidationLevel": "MEDIUM" } }Response (200 OK): the subaccount, now carrying the tier.
Finally register a webhook for the enrollment and transaction events. A webhook.site URL works well as a throwaway receiver:
curl -X POST https://api.sandbox.astrada.co/webhooks \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"subaccountId": "{subaccountId}",
"url": "https://webhook.site/your-unique-url",
"description": "card enrollment test",
"eventTypes": [
"cardsubscription.created",
"cardsubscription.updated",
"transaction.created",
"transaction.updated",
"transactionmessage.created"
]
}'Response (201 Created): the webhook with its signing secret:
{
"id": "bcfa12e5-5870-415e-bef3-af8b3cbe159f",
"subaccountId": "2c5a170e-bcdc-461a-880c-db962d610653",
"url": "https://webhook.site/your-unique-url",
"description": "card enrollment test",
"enabled": true,
"eventTypes": ["cardsubscription.created", "cardsubscription.updated", "transaction.created", "transaction.updated", "transactionmessage.created"],
"secret": "N2ViZDU2ZWMtMGMxYi00NDc5…",
"createdAt": "2026-09-02T01:44:46.481Z",
"updatedAt": "2026-09-02T01:44:46.481Z"
}2. Pick a test card
Each published test card fixes the verification outcome, so you choose the path you want to exercise by choosing the card. The cards used in this guide:
| Card | Network | What happens |
|---|---|---|
4242 4242 4242 4242 | Visa | Frictionless: verification completes with no challenge |
5555 5555 5555 4444 | Mastercard | Frictionless: verification completes with no challenge |
4000 0027 6000 3184 | Visa | 3DS challenge, then success |
5200 8282 8282 8210 | Mastercard | 3DS challenge, then success |
4000 0084 0000 1629 | Visa | 3DS authentication fails |
Any expiry in the future and any three-digit CVC work. The complete matrix, including decline and lockout cards and the HIGHEST two-hold flow, is in Test Cards & Sandbox Testing.
Submitting any other card number is rejected up front, before any processing, with a 403 and the error code card_subscription.sandbox_card_not_allowed. The allowlist matches the full card number exactly, never a prefix.
3. Enroll a card with SDK v2
SDK v2 renders the card screens, the 3DS challenge and every follow-up step for you. In sandbox, load the script from the sandbox host; it reads the environment from its own address and calls the sandbox API. persona: "admin" opens the page a card admin sees; Open a session covers the other options:
<script
type="text/javascript"
src="https://sdk.sandbox.astrada.co/unified/v2/unifiedEnrollmentSdk.js"
data-id="unified-enrollment-sdk"
></script>
<script>
UnifiedEnrollmentSdk.open({
subaccountId: "{subaccountId}",
companyName: "Your company",
getAccessToken: () => fetch("/your-backend/astrada-sandbox-token").then((r) => r.text()),
persona: "admin",
onEvent: (event) => {
if (event.type === "card-enrolled") console.log("enrolled", event.cardId, event.subscriptionId);
},
onSuccess: (result) => console.log("session done", result.cards),
onError: (error) => console.log("failed", error.code, error.verificationId),
onCancel: () => console.log("cancelled"),
});
</script>
Get the token on your backend
getAccessTokenmust return a token your backend requests with your sandbox client credentials, exactly as in production. A token request from the browser fails with403 {"error":"Invalid origin"}unless the calling origin is registered on your OAuth client.
The SDK sends the cardholder's consent record for you, so this step needs nothing extra for consent (The consent record).
On the admin page, type the first 8 digits of a card from step 2 and press Continue. The card form opens with those digits filled in. Finish the number, enter any future expiry and any CVC, tick the consent box and press Connect:

SDK v2 on an admin page with test card 4242 4242 4242 4242.
- A frictionless card (
4242…,5555…) verifies with no challenge.onEventgetscard-enrolledwith thecardId, thesubscriptionIdandenrollmentType: "cardholder-single", and the SDK shows its success screen. - A challenge card (
4000 0027 6000 3184or5200 8282 8282 8210) shows a test issuer challenge inside the SDK; complete it andcard-enrolledarrives the same way. The Visa card shows Stripe's test page and the Mastercard card shows Astrada's mock issuer page; on the mock page, either button returns the result the card is set to. - The failing card (
4000 0084 0000 1629) firesonErrorwithflow: "card"and theverificationId, plus thecardIdandsubscriptionIdthe flow had created.GET /card-verifications/3ds/{verificationId}returns itsfailureReason; every code is catalogued in Error States & Remediation.
When the person closes the SDK, onSuccess runs once with every card the session enrolled under cards, keyed by cardId (What onSuccess gets).
The playground linked at the top of this page runs this same session with your credentials, without any code.
4. Enroll a card with the API (optional)
Not needed when you use the SDKStep 3 already created the card subscription and ran the verification for you. This step shows the same sequence as raw API calls, for automated tests. A production integration that renders its own card form needs Astrada's approval for direct API enrollment. If you enrolled with the SDK, skip to step 5.
First create the card subscription. The body carries consent with the Visa network wording the cardholder saw, which every consent mode accepts. If Astrada has approved you for direct API enrollment, Send the consent record covers the other consent fields.
POST /card-subscriptions HTTP/1.1
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json
{
"subaccountId": "{subaccountId}",
"pan": "4242424242424242",
"expiryMonth": 12,
"expiryYear": 2031,
"cvc": "123",
"cardholderName": "Sandbox Test",
"country": "USA",
"consent": {
"channel": "api",
"text": "By submitting your card information and checking this box, you authorize Visa to access, monitor and share transaction data (e.g., amount, time, date, and merchant name) with Astrada (our service provider) for the purposes of identifying relevant transactions and carrying out related spend management services. You also affirm that the card being monitored is used primarily for business purposes."
}
}curl -X POST https://api.sandbox.astrada.co/card-subscriptions \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"subaccountId": "{subaccountId}",
"pan": "4242424242424242",
"expiryMonth": 12,
"expiryYear": 2031,
"cvc": "123",
"cardholderName": "Sandbox Test",
"country": "USA",
"consent": {
"channel": "api",
"text": "By submitting your card information and checking this box, you authorize Visa to access, monitor and share transaction data (e.g., amount, time, date, and merchant name) with Astrada (our service provider) for the purposes of identifying relevant transactions and carrying out related spend management services. You also affirm that the card being monitored is used primarily for business purposes."
}
}'{
"subaccountId": "{subaccountId}",
"pan": "4242424242424242",
"expiryMonth": 12,
"expiryYear": 2031,
"cvc": "123",
"cardholderName": "Sandbox Test",
"country": "USA",
"consent": {
"channel": "api",
"text": "By submitting your card information and checking this box, you authorize Visa to access, monitor and share transaction data (e.g., amount, time, date, and merchant name) with Astrada (our service provider) for the purposes of identifying relevant transactions and carrying out related spend management services. You also affirm that the card being monitored is used primarily for business purposes."
}
}Response (201 Created): the subscription in reqSCA, waiting for the cardholder verification:
{
"id": "12c6fb2e-c7a9-4b54-9807-100a8e67b7a0",
"cardId": "639b3d2c-d365-4935-a63f-beed93334c1b",
"subaccountId": "2c5a170e-bcdc-461a-880c-db962d610653",
"state": "reqSCA",
"enrollmentType": "cardholder-single",
"effectiveDate": "2026-09-02T01:28:29.278Z",
"expirationDate": "2031-12-31T23:59:59.999Z",
"createdAt": "2026-09-02T01:28:29.285Z",
"updatedAt": "2026-09-02T01:28:30.541Z"
}Then start the 3DS verification with the same card details:
POST /card-verifications/3ds HTTP/1.1
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json
{
"subaccountId": "{subaccountId}",
"pan": "4242424242424242",
"expiryMonth": 12,
"expiryYear": 2031,
"cvc": "123",
"cardholderName": "Sandbox Test"
}curl -X POST https://api.sandbox.astrada.co/card-verifications/3ds \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"subaccountId": "{subaccountId}",
"pan": "4242424242424242",
"expiryMonth": 12,
"expiryYear": 2031,
"cvc": "123",
"cardholderName": "Sandbox Test"
}'{
"subaccountId": "{subaccountId}",
"pan": "4242424242424242",
"expiryMonth": 12,
"expiryYear": 2031,
"cvc": "123",
"cardholderName": "Sandbox Test"
}Response (201 Created) for a frictionless card: the verification is already completed, and the subscription activates a moment later:
{
"id": "69899a27-b819-4b28-aee0-73d2c9f3d636",
"type": "3DS",
"state": "completed",
"currentStepId": null,
"cardId": "639b3d2c-d365-4935-a63f-beed93334c1b",
"subaccountId": "2c5a170e-bcdc-461a-880c-db962d610653",
"createdAt": "2026-09-02T01:28:38.036Z",
"updatedAt": "2026-09-02T01:28:38.036Z"
}For a challenge card the verification stays in-progress and hands you the challenge step, with a test-mode publishable key:
{
"id": "3319eb0e-68f9-4f6b-98c0-70bfdbe44712",
"type": "3DS",
"state": "in-progress",
"currentStepId": "stripe-3ds",
"cardId": "28a16fa8-b1d6-4716-82bb-9f7006d269cb",
"subaccountId": "2c5a170e-bcdc-461a-880c-db962d610653",
"clientSecret": "seti_…_secret_…",
"stripePublishableKey": "pk_test_…"
}Completing that step needs a browser: the call sequence on the test-cards page shows how to run the challenge and post steps/stripe-callback, after which GET /card-verifications/3ds/{verificationId} returns the final state. The failing card takes the same branch and ends failed, with its failureReason on the GET.
A Mastercard challenge card returns currentStepId: "fingerprint" instead and runs the card network's own 3DS steps (fingerprint, then challenge) against mock issuer pages: load the fingerprint step's threeDSMethodURL in a hidden iframe, then the challenge step's acsUrl in a visible one, as the direct API guide describes for approved partners. The test card fixes the outcome.
A subaccount with no tier sends Visa down the same network steps; see Visa on a subaccount with no tier for the Visa cards emulated there.
5. See what was created
Read the subscription back; once the verification completed it is active:
curl https://api.sandbox.astrada.co/card-subscriptions/{subscriptionId} \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"Response (200 OK):
{
"id": "12c6fb2e-c7a9-4b54-9807-100a8e67b7a0",
"cardId": "639b3d2c-d365-4935-a63f-beed93334c1b",
"subaccountId": "2c5a170e-bcdc-461a-880c-db962d610653",
"state": "active",
"enrollmentType": "cardholder-single",
"effectiveDate": "2026-09-02T01:28:29.278Z",
"expirationDate": "2031-12-31T23:59:59.999Z",
"createdAt": "2026-09-02T01:28:29.285Z",
"updatedAt": "2026-09-02T01:28:40.532Z"
}The card itself is at GET /cards/{cardId}:
{
"id": "639b3d2c-d365-4935-a63f-beed93334c1b",
"subaccountId": "2c5a170e-bcdc-461a-880c-db962d610653",
"network": "visa",
"first6digits": "424242",
"last4digits": "4242",
"expiryMonth": 12,
"expiryYear": 2031,
"country": "USA",
"createdAt": "2026-09-02T00:37:34.917Z",
"updatedAt": "2026-09-02T00:37:34.917Z"
}Your webhook received cardsubscription.created with state: "reqSCA" when the subscription was created, then cardsubscription.updated with state: "active" when the verification completed. The SDK path produces exactly the same two events.
6. Simulate a transaction
With the card active, run a transaction scenario against it. amount is in minor units (1500 is 15.00) and currency is an ISO 4217 code; both are optional and default per scenario. For a Mastercard card pass "network": "MASTERCARD", otherwise the scenario's default network is used:
POST /simulate/transaction/scenario HTTP/1.1
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json
{
"scenario": "simple_purchase",
"cardId": "{cardId}",
"subaccountId": "{subaccountId}",
"amount": 1500,
"currency": "USD"
}curl -X POST https://api.sandbox.astrada.co/simulate/transaction/scenario \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"scenario": "simple_purchase",
"cardId": "{cardId}",
"subaccountId": "{subaccountId}",
"amount": 1500,
"currency": "USD"
}'{
"scenario": "simple_purchase",
"cardId": "{cardId}",
"subaccountId": "{subaccountId}",
"amount": 1500,
"currency": "USD"
}Response (202 Accepted): one entry per transaction the scenario creates, each listing the message ids it will publish (an authorization and a clearing for simple_purchase):
{
"transactions": [
{ "messageIds": ["6863b28c-aeb3-4331-9663-9fc2ccfa5aed", "11d038b7-fe95-4ef6-9069-34aabe1e1d83"] }
]
}Processing is asynchronous. Within about thirty seconds the transaction is readable, and transaction.created, transaction.updated and transactionmessage.created arrive on the webhook:
curl "https://api.sandbox.astrada.co/transactions?cardId={cardId}" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"Response (200 OK):
{
"_embedded": {
"transactions": [
{
"id": "064861a4-bd59-43f4-b779-426357764268",
"cardId": "639b3d2c-d365-4935-a63f-beed93334c1b",
"subaccountId": "2c5a170e-bcdc-461a-880c-db962d610653",
"network": "VISA",
"status": "SETTLED",
"transactionType": "DEBIT_01",
"descriptor": "BLUE BOTTLE COFFEE",
"acceptor": { "city": "SAN FRANCISCO", "state": "CA", "country": "840", "mcc": "5814" },
"transactionCurrency": "USD",
"transactionHoldAmount": 0,
"transactionSettledAmount": 15,
"cardholderBillingCurrency": "USD",
"cardholderBillingHoldAmount": 0,
"cardholderBillingSettledAmount": 15,
"transactionOccurrenceDate": "2026-09-02",
"createdAt": "2026-09-02T01:36:19.057Z",
"updatedAt": "2026-09-02T01:36:20.366Z"
}
]
}
}The other scenarios (refund, hotel_preauth, partial_clearing, recurring_subscription, and more) exercise holds, adjustments and multi-message flows; the catalog and every parameter are in the Sandbox API Reference.
7. Webhooks checklist
Across a successful run your receiver gets these events. Delivery order is not guaranteed, so read state and status rather than the arrival order:
cardsubscription.createdwithstate: "reqSCA", sent when the card subscription is created.cardsubscription.updatedwithstate: "active", sent when the verification completes.transactionmessage.createdfor each message the scenario publishes, plustransaction.createdandtransaction.updatedas the transaction settles.
A failed verification leaves the subscription in reqSCA and produces no cardsubscription.updated.
8. Clean up
curl -X DELETE "https://api.sandbox.astrada.co/card-subscriptions/{subscriptionId}" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"Response (204 No Content): the subscription and, when it is the last subscription on the card, the card, cardholder and transactions are deleted. Deleting the subaccount itself (DELETE /subaccounts/{subaccountId}) tears down everything in one call; see Cleaning up test data.
Next steps
- SDK v2: Quick Start: the production on-ramp for the SDK.
- SDK v2: Events and callbacks: every field of
card-enrolled,errorandonSuccess. - Test Cards & Sandbox Testing: every test card and the outcome it produces.
- Error States & Remediation: reproduce and handle every failure path.
- Sandbox API Reference: the simulation endpoint reference.
Updated 5 days ago
