Before testing network tokens in sandbox, make sure your account is fully enrolled to network tokenization.

Speak to your Customer Success Manager or raise a ticket on our JIRA Service Desk. If you don’t have access, please contact your account administrator for assistance.

Visa’s testing environment is frequently reset, which makes testing Visa network tokens extremely unreliable.

As a result, testing Visa network tokenization is not available on Primer sandbox. We encourage you to only test Mastercard network tokenization in sandbox, and to test Visa network tokenization in production.

Provisioning network tokens

On sandbox, Primer attempts to provision a network token whenever a card is added to the vault of a customer ID starting with primer-nt-testing.

The best way to vault a card is to use Universal Checkout. Make sure to call

with a “customerId” and “vaultOnSuccess” set to true. This automatically vaults the card if the payment is successfully authorized.

This first payment is processed using the raw card data. Once vaulted, it usually takes a few seconds for the network token to be provisioned and available for subsequent payments.

Use the following test cards to simulate scenarios:

ScenarioCard NetworkCard NumberCVVExpiry date
Eligible cardMastercard2222 6904 2006 4590Any 3 digit numberAny future expiry date
Eligible cardMastercard2222 6904 2006 4574Any 3 digit numberAny future expiry date
Eligible cardMastercard2222 6904 2006 4590Any 3 digit numberAny future expiry date
Eligible cardMastercard5120 3501 0006 4594Any 3 digit numberAny future expiry date
Non-eligible cardMastercard5460 1261 2820 0800Any 3 digit numberAny future expiry date

To validate that the card was properly network tokenized, call

to list the saved payment methods for a specific customerId. The field “paymentMethod.isNetworkTokenized” is set to true when the network token was successfully provisioned and attached to the vaulted card.

Processing payments with network tokens

When a payment is created with a vaulted card that has been network tokenized, Primer automatically attempts to pass the network token to the processor, if the processor is supported.

You can test this by creating a payment with:

  • the Payments API by following this guide
  • or with the vault section of Universal Checkout, by selecting a vaulted card that was network tokenized

To validate that the payment used a network token, call

with the payment ID to retrieve the payment object. The field “cardTokenType” is set to:

  • NETWORK_TOKEN if the payment was processed with a network token
  • CARD_PAN if the payment was processed with the raw credentials