Skip to main content

Network Tokens Testing

Basis Theory provides a Network Tokens sandbox environment that provides stubbed responses without forwarding your requests to the card networks.

Once the feature is enabled, test tenants will be configured to use the Network Tokens sandbox, and you can use the test cards defined below to simulate various scenarios.

Planning your full integration test? See Platform Testing for how to validate each leg of the chain across Basis Theory, your PSP, and the card networks.

Test Cards

The following test cards can be used to test different error and success scenarios when creating network tokens.

PANCard BrandResponseError Title
4000000000000002VisaSuccess[Not Applicable]
4000000000000085VisaSuccess[Not Applicable]
4000000000000093VisaSuccess[Not Applicable]
5100000000000008MastercardSuccess[Not Applicable]
5100000000000065MastercardSuccess[Not Applicable]
5100000000000073MastercardSuccess[Not Applicable]
6011000000000004DiscoverSuccess[Not Applicable]
370000000000002American ExpressSuccess[Not Applicable]
370000000000069American ExpressSuccess[Not Applicable]
370000000000077American ExpressSuccess[Not Applicable]
4012888888881881VisaProvision Data ExpiredPROVISION_DATA_EXPIRED
5105105105105100MastercardProvision Data ExpiredPROVISION_DATA_EXPIRED
6011601160116611DiscoverProvision Data ExpiredPROVISION_DATA_EXPIRED
371449635398431American ExpressProvision Data ExpiredPROVISION_DATA_EXPIRED
4330251207506660VisaCard Verification FailedCARD_VERIFICATION_FAILED
5461310156953048MastercardCard Verification FailedCARD_VERIFICATION_FAILED
6011168802268945DiscoverCard Verification FailedCARD_VERIFICATION_FAILED
370488998077498American ExpressCard Verification FailedCARD_VERIFICATION_FAILED
4539097887163333VisaCard Not EligibleCARD_NOT_ELIGIBLE
5325191087030619MastercardCard Not EligibleCARD_NOT_ELIGIBLE
6011690151507086DiscoverCard Not EligibleCARD_NOT_ELIGIBLE
373555735376156American ExpressCard Not EligibleCARD_NOT_ELIGIBLE
4929980395567582VisaCard Not AllowedCARD_NOT_ALLOWED
5580422612666704MastercardCard Not AllowedCARD_NOT_ALLOWED
6011444770992901DiscoverCard Not AllowedCARD_NOT_ALLOWED
378025849667382American ExpressCard Not AllowedCARD_NOT_ALLOWED
4929544240318920VisaCard DeclinedCARD_DECLINED
5157204564548129MastercardCard DeclinedCARD_DECLINED
6011760519541711DiscoverCard DeclinedCARD_DECLINED
348322853530243American ExpressCard DeclinedCARD_DECLINED
4916725297925395VisaProvision Not AllowedPROVISION_NOT_ALLOWED
5336475987107024MastercardProvision Not AllowedPROVISION_NOT_ALLOWED
6011490740263725DiscoverProvision Not AllowedPROVISION_NOT_ALLOWED
375155165213132American ExpressProvision Not AllowedPROVISION_NOT_ALLOWED
4711358892785746VisaCard Eligibility ErrorCARD_ELIGIBILITY_ERROR
5233580618829955MastercardCard Eligibility ErrorCARD_ELIGIBILITY_ERROR
6011000990139424DiscoverCard Eligibility ErrorCARD_ELIGIBILITY_ERROR
348835199015504American ExpressCard Eligibility ErrorCARD_ELIGIBILITY_ERROR
5555555555554444MastercardIssuer DeclinedISSUER_DECLINED
These cards are not valid for real transactions and should only be used in the Basis Theory sandbox environment. The network token value returned in the sandbox is also simulated, so your PSP or the card networks will not necessarily accept it in their own sandboxes.

Deduplication

When the same PAN is provisioned more than once within a tenant, the API returns the existing Network Token with _extras.deduplicated: true rather than creating a new one. The sandbox behaves the same as production, so you can validate your integration's handling of idempotent provisioning before going live. See Deduplication for the full contract.

Deduplication is tenant-scoped. Provisioning the same PAN across different tenants produces separate Network Tokens in each.

Card Art

In the sandbox, the Get a Network Token Account endpoint returns Basis Theory-hosted placeholder images for logo and card_image in place of network-provided assets. The image dimensions, descriptions, and background_color are returned as-is, so you can build and verify your card art rendering before going live. In production, these fields are populated with the card art the network returns for the provisioned card.

Card art availability varies by network. Design your checkout to fall back to a brand logo when logo, card_image, or background_color are null.

Basis Theory maintains the table below as the canonical customer-facing contract for Network Token provisioning errors. Each error title maps to exactly one detail message. Use the title, rather than the detail text, for programmatic handling, and handle unknown titles without automatically retrying them.

Error TitleCanonical DetailRecommended ActionRetry Handling
PROVISION_DATA_EXPIREDThe provided card information has expired or changed.Request updated card details from the user.After correction
CARD_VERIFICATION_FAILEDInvalid payment instrument or data associated with the payment instrument.Use a different card. If a CVV was provided, verify that it is correct.Do not retry
CARD_NOT_ELIGIBLEThis card is not eligible for network tokenization by the issuer.Use a different card.Do not retry
CARD_NOT_ALLOWEDTokenization is currently blocked for this card.Contact the issuer or use a different card.Do not retry
CARD_DECLINEDThe card was declined by the issuer during processing.Contact the issuer or use a different card.Do not retry
ISSUER_DECLINEDThe card was declined by the issuing bank.Contact the issuing bank or use a different card.Do not retry
PROVISION_NOT_ALLOWEDTokenization is not allowed for this card or user.Contact the issuer or use a different card.Do not retry
CARD_ELIGIBILITY_ERRORThe card is not eligible for network tokenization.Use a different card.Do not retry
CARD_CANNOT_BE_TOKENIZEDThe Card is ineligible for tokenization due to an ongoing issue.Use a different card.Do not retry
CARD_NUMBER_LENGTH_INVALIDThe card number does not meet the required length. Please check the card number and try again.Correct the card number.After correction
CARD_DATA_MISSINGRequired card data (card number, expiration year, and/or expiration month) is missing.Add the missing card data.After correction
INVALID_PROPERTYA property validation check has failed.Correct the invalid property.After correction
INVALID_INPUTCould not find data linked with the provided input.Verify the referenced input and identifiers.After correction
INVALID_FORMATA required network tokenization identifier has an invalid format.Correct the identifier.After correction
TOKENIZATION_RESOURCE_NOT_FOUNDA required network tokenization resource could not be found.Verify the referenced Network Token and contact Basis Theory support if it exists.After correction
INVALID_REQUESTThe tokenization service could not validate the request.Review and correct the request.After correction
INVALID_PAN_REFERENCE_FORMATThe PAN reference format is invalid.Verify the referenced Network Token.After correction
INVALID_PAN_REFERENCEThe requested PAN could not be found.Verify the referenced Network Token.After correction
INVALID_TOKEN_REFERENCE_FORMATThe token reference format is invalid.Verify the referenced Network Token.After correction
NO_ACTIVE_TOKENSThere are no active (not suspended) Tokens for the given Account PAN and consumer account.Provision the card again.Do not retry
INVALID_PAN_FORMATThe PAN format is invalid, or other data associated with the PAN was incorrect or entered incorrectly.Correct the card data.After correction
INVALID_PANThe card number could not be validated for network tokenization.Verify the card data or use a different card.After correction
INVALID_PAN_NETWORKThe PAN network is invalid.Use a supported card.Do not retry
INVALID_PAN_EXPIRY_FORMATThe PAN expiry format is invalid.Correct the expiration date.After correction
INVALID_PAN_EXPIRYThe PAN expiry is invalid.Correct the expiration date.After correction
INVALID_TOKEN_STATUSThe current token's status doesn't support the requested operation.Retrieve the current status and retry only after it changes to a compatible state.After correction
CARD_EXPIREDCard expired.Use an updated or different card.Do not retry
CARD_CANCELLEDCard is cancelled.Use a different card.Do not retry
ISSUER_NOT_SUPPORTEDThe Issuer of the Card provided does not support provisioning for cards they issue.Use a card from a supported issuer.Do not retry
DUPLICATE_REQUESTThe PAN has already been provisioned to the device or the same request is currently being processed.If you already hold the Network Token for this card, use it. If you do not — for example, the original response was lost — wait for the in-flight request to finish, then provision the card again once to receive the existing token via deduplication. If that attempt returns DUPLICATE_REQUEST again, the card is already provisioned upstream and repeating the call will not resolve it; stop retrying and contact Basis Theory support.After correction
INVALID_TOKEN_REFERENCEThe requested token could not be found.Verify the Network Token identifier.After correction
RESOURCE_NOT_FOUNDThe requested resource could not be found.Verify the referenced resource and contact Basis Theory support if it exists.After correction
CARD_MARKET_NOT_SUPPORTEDThe market of the Card provided is not supported.Use a supported card.Do not retry
UNAUTHORIZED_OPERATIONThe Token Reference ID cannot have its status changed as the token has been deleted.Retrieve the current status and stop the operation if the token was deleted.Do not retry
INVALID_TRID_NETWORKThe TRID is invalid or the specified network is not supported.Verify the Token Requestor configuration or contact Basis Theory support.Do not retry
INVALID_PARAMETERThe request does not have a valid set of parameters required to process it.Correct the request parameters or card details.After correction
VALIDATION_FAILEDOne or more card fields failed validation.Correct the invalid card fields.After correction
NETWORK_ERRORA network error occurred while contacting the card network. The request can be retried.Retry with backoff.Automatic retry
NO_RESPONSE_FROM_ISSUERThe card issuer did not respond in time. The request can be retried.Retry with backoff.Automatic retry
NETWORK_RATE_LIMITThe card network's rate limit was exceeded. The request can be retried after a short delay.Wait and retry with backoff.Automatic retry
UNEXPECTED_ERRORAn unexpected error occurred during network tokenization.Contact Basis Theory support if the error persists.Do not retry

Retry handling has the following meanings:

  • Automatic retry: Retry the same request with exponential backoff and the same idempotency key.
  • After correction: Do not retry automatically. Correct the input or state described in the recommended action, then submit the request again.
  • Do not retry: Repeating the same request is not expected to succeed. Follow the recommended action instead.
The specific titles in this table can replace UNEXPECTED_ERROR for conditions that were previously not classified. The response schema and HTTP status remain unchanged. If your integration treats every 422 response as terminal or matches on the detail message, update it to branch on the error title and retry handling above.