Documentation
Feedback
Guides
API Reference

Guides
Guides
Integration Guides

Implementing payments tokenization

Payment tokenization is the VTEX solution that allows providers to process payment transactions using tokens instead of real credit card data. This approach adds a layer of security to the process, reducing the exposure of sensitive information and the risk of fraud or attacks.

This feature is currently in the testing phase (Closed Beta), which means that only select clients can access it. If you'd like to implement it in the future, contact our Support.

Benefits and features

Tokenization allows you to:

  • Integrate PCI and non-PCI systems: Import or export tokenized cards between PCI-compliant environments (such as the VTEX gateway) and non-PCI customer systems, such as ERPs or corporate purchasing platforms (B2B).
  • Automatic token update: Automatically assign new tokens when a credit card expires and is replaced, improving the customer experience, especially in specific recurring purchase scenarios like subscriptions.

VTEX doesn't generate or request tokens from other services. It only stores tokens imported directly into the Card Token Vault (CTV) or returned by a payment provider in the authorization response.

Payment tokenization is available only for stores with checkout in the Headless and FastCheckout architecture. The feature supports proprietary tokens from payment providers and also allows using Network Tokens when the connector acts as a Token Requester and sends the token back to VTEX.

Steps for deployment

To make the tokenization feature available to your customers, the payment provider must:

  1. Update the connector manifest
  2. Configure the sending of tokenized information
  3. Integrate with the Card Token Vault (CTV)
  4. Validate the tokenization implementation

Updating the connector manifest

The payment provider must include the following fields in the connector manifest:

FieldRequiredTypeDescription
versionYesstringIndicates the version of the Payment Provider Protocol (PPP) to be used in requests. The default value is 1.0.0. For card tokenization operations, use the value 2.0.0.
cardTokenNoobjectObject containing information required for card tokenization operations. This object and all its nested fields are required only when the version field is set to 2.0.0.
canAcceptCardTokenNobooleanIndicates whether the payment provider can process tokenized cards.
cardTokenAcceptedTypesNoarrayIndicates the types of tokens accepted by the payment provider. Possible values are: TOKEN_FILE, TOKEN_CLIENT_ID, and TOKEN_VALUE.
cardGenerateCardTokenNobooleanIndicates whether the payment provider can generate a new card after processing a PAN card.

Example of a manifest with tokenization enabled:


_10
{
_10
...
_10
"version": "2.0.0",
_10
"cardToken": {
_10
"canAcceptCardToken": true,
_10
"cardTokenAcceptedTypes": ["TOKEN_VALUE"],
_10
"canGenerateCardToken": true
_10
}
_10
...
_10
}

After reviewing the manifest, open a ticket with VTEX Technical Support to request the connector update.

Configuring the sending of tokenized information

In addition to updating the manifest, you must include specific fields in the Payment Gateway and Payment Provider Protocol endpoints, according to the type of credit card used in the tokenized transaction. Card types are classified as follows:

  • Cards with PAN (Primary Account Number): Cards not yet tokenized in the Card Token Vault (CTV).
  • Tokenized cards saved on VTEX: Cards already stored in CTV and reused in a payment transaction.
  • External tokenized cards: Tokenized cards stored in external systems, which may or may not later be saved on VTEX.

Below are examples of requests and responses for each payment transaction scenario:

Scenario 1: Transaction using credit card with PAN

Payment Gateway (Send payments information)

  • Request body: Doesn't send specific fields for tokenization.
  • Response body: Received fields about tokenization.

_10
[
_10
...
_10
"fields": [
_10
{
_10
"name": "accountId",
_10
"value": "string"
_10
}
_10
]
_10
...
_10
]

Payment Provider Protocol (Create payment)

  • Request body: Fields sent for tokenization.

_10
{
_10
...
_10
"saveCreditCard": true,
_10
"useCardToken": true
_10
...
_10
}

  • Response body: Received fields about tokenization.

_14
{
_14
...
_14
"isNewTokenization": true,
_14
"generatedCardToken": {
_14
"cardTokenType": "TOKEN_VALUE",
_14
"cardTokenHref": "string",
_14
"tokenExtraData": {
_14
"extraData1": "string",
_14
"extraData2": "string"
_14
},
_14
"useCvvForAuthorization": true
_14
}
_14
...
_14
}

When the saveCreditCard field is sent with the value false in the request body of the Create payment endpoint, VTEX won't store the credit card and the response body won't return tokenization data.

Scenario 2: Transaction using tokenized credit card stored in VTEX

Payment Gateway (Send payments information)

  • Request body: Fields sent for tokenization.

_10
[
_10
...
_10
"fields": {
_10
"accountId": "string"
_10
}
_10
...
_10
]

  • Response body: Received fields about tokenization.

_10
[
_10
...
_10
"fields": [
_10
{
_10
"name": "accountId",
_10
"value": "string"
_10
}
_10
]
_10
...
_10
]

Payment Provider Protocol (Create payment)

  • Request body: Fields sent for tokenization.

_10
{
_10
...
_10
"saveCreditCard": false,
_10
"useCardToken": true
_10
...
_10
}

  • Response body: Received fields about tokenization.

_14
{
_14
...
_14
"isNewTokenization": false,
_14
"generatedCardToken": {
_14
"cardTokenType": "TOKEN_VALUE",
_14
"cardTokenHref": "string",
_14
"tokenExtraData": {
_14
"extraData1": "string",
_14
"extraData2": "string"
_14
},
_14
"useCvvForAuthorization": true
_14
}
_14
...
_14
}

Scenario 3: Transaction using external tokenized credit card (not to be saved in VTEX)

Payment Gateway (Send payments information)

  • Request body: Fields sent for tokenization.

_19
[
_19
...
_19
"fields": [
_19
{
_19
"accountId": "null",
_19
"cardTokenData": {
_19
"cardTokenType": "TOKEN_FILE",
_19
"cardTokenHref": "https://linktothetokenfile.com",
_19
"tokenExtraData": {
_19
"extraData1": "string",
_19
"extraData2": "string"
_19
},
_19
"useCvvForAuthorization": "boolean",
_19
"cardTokenCvv": "string"
_19
}
_19
}
_19
]
_19
...
_19
]

  • Response body: Received fields about tokenization.

_14
[
_14
...
_14
"fields": [
_14
{
_14
"name": "isCardToken",
_14
"value": "true"
_14
},
_14
{
_14
"name": "accountId",
_14
"value": "string"
_14
}
_14
]
_14
...
_14
]

Payment Provider Protocol (Create payment)

  • Request body: Fields sent for tokenization.

_17
{
_17
...
_17
"saveCreditCard": false,
_17
"useCardToken": true,
_17
"cardTokenData": {
_17
"cardTokenType": "TOKEN_VALUE",
_17
"cardTokenValue": "string",
_17
"tokenExtraData": {
_17
"extraData1": "string",
_17
"extraData2": "string"
_17
},
_17
"useCvvForAuthorization": true,
_17
"cardTokenCvv": "string"
_17
},
_17
"shopperInteration": "string"
_17
...
_17
}

  • Response body: Received fields about tokenization.

_14
{
_14
...
_14
"isNewTokenization": true,
_14
"generatedCardToken": {
_14
"cardTokenType": "TOKEN_VALUE",
_14
"cardTokenHref": "string",
_14
"tokenExtraData": {
_14
"extraData1": "string",
_14
"extraData2": "string"
_14
},
_14
"useCvvForAuthorization": true
_14
}
_14
...
_14
}

Scenario 4: Transaction with external tokenized credit card (to be saved in VTEX)

Payment Gateway (Send payments information)

  • Request body: Fields sent for tokenization.

_24
[
_24
...
_24
"fields": {
_24
"accountId": "null",
_24
"savePaymentData": true,
_24
"cardData": {
_24
"cardLabel": "string",
_24
"paymentName": "enum",
_24
"bin": "string",
_24
"lastDigits": "string"
_24
},
_24
"cardTokenData": {
_24
"cardTokenType": "TOKEN_FILE",
_24
"cardTokenHref": "https://linktothetokenfile.com",
_24
"tokenExtraData": {
_24
"extraData1": "string",
_24
"extraData2": "string"
_24
},
_24
"useCvvForAuthorization": "boolean",
_24
"cardTokenCvv": "string"
_24
}
_24
}
_24
...
_24
]

  • Response body: Received fields about tokenization.

_14
[
_14
...
_14
"fields": [
_14
{
_14
"name": "isCardToken",
_14
"value": "true"
_14
},
_14
{
_14
"name": "accountId",
_14
"value": "string"
_14
}
_14
]
_14
...
_14
]

Payment Provider Protocol (Create payment)

  • Request body: Fields sent for tokenization.

_17
{
_17
...
_17
"saveCreditCard": true,
_17
"useCardToken": true,
_17
"cardTokenData": {
_17
"cardTokenType": "TOKEN_VALUE",
_17
"cardTokenValue": "string",
_17
"tokenExtraData": {
_17
"extraData1": "string",
_17
"extraData2": "string"
_17
},
_17
"useCvvForAuthorization": true,
_17
"cardTokenCvv": "string"
_17
},
_17
"shopperInteration": "string"
_17
...
_17
}

  • Response body: Received fields about tokenization.

_14
{
_14
...
_14
"isNewTokenization": true,
_14
"generatedCardToken": {
_14
"cardTokenType": "TOKEN_VALUE",
_14
"cardTokenHref": "string",
_14
"tokenExtraData": {
_14
"extraData1": "string",
_14
"extraData2": "string"
_14
},
_14
"useCvvForAuthorization": true
_14
}
_14
...
_14
}

For more information on the full payload of the requests, see the documentation for the Send payments information and Create payment endpoints.

Integrating the Card Token Vault (CTV) system

The Card Token Vault (CTV) is the VTEX system for storing and managing credit card token information. Its main features are:

  • Full token CRUD (create, read, update, delete).
  • Bulk import of tokens via .XLSX file.
  • Secure storage with AES encryption.
  • Activity tracking with full audit support.

The CTV stores the following types of information for each token:

FieldRequiredTypeDescription
idYesstringToken ID in the system.
accountNameYesstringVTEX account name in License Manager (example: carrefourbr, cea).
providerIdYesstringConnector owner account name used to create the token (example: worldpay).
profileIdNostringProfile ID in the Profile System.
orderGroupNostringOrder identifier.
emailNostringUsed only if neither profileId nor orderGroup is provided (rare).
shopperIdNostringUsed only if none of profileId, orderGroup, or email is provided.
card.paymentSystemIdNostringPayment system ID in the Payment Gateway.
card.paymentSystemNameYesstringCard brand (example: Visa, Mastercard).
card.firstDigitsYesstringCard BIN (first six digits).
card.lastDigitsYesstringThe last four digits of the card.
card.address.addressTypeNostringAddress type (example: residential or pickup point).
card.address.addressIdNostringAddress identifier.
card.address.postalCodeNostringPostal code (ZIP/CEP).
card.address.streetNostringStreet name.
card.address.neighborhoodNostringNeighborhood name.
card.address.cityNostringCity name.
card.address.stateNostringState name.
card.address.countryNostringCountry name.
card.address.numberNostringStreet number.
card.address.complementNostringAddress complement (example: apartment, building).
card.holderNameNostringName of the cardholder as printed on the card.
cardTokenData.typeYesstringType of token (example: FILE, TOKEN_CLIENT_ID, TOKEN_VALUE).
cardTokenData.valueNostringToken value used in transactions.
cardTokenData.expirationYesstringToken expiration date in YYYY-MM format.
cardTokenData.labelNostringToken alias (used instead of lastDigits in the UI).
cardTokenData.providerCardTokenIdNostringClient ID used to retrieve the token from the provider.
cardTokenData.useCvvForAuthorizationNobooleanFlag indicating if CVV is required (default: true).
cardTokenData.hrefNostringURL of the token file stored by the provider.
extraDataNoobjectDictionary <string, string> for additional data.

Integrate with CTV using the Card Token Vault API, available in the Developer Portal.

See the Managing tokenized cards guide for details on token management.

Validating the deployment of payment tokenization

Before you start validation on the provider side, make sure you have an account set up for headless purchases (without using the VTEX Admin). Then perform purchase tests as described in the guide Creating a regular order with the Checkout API.

After testing headless purchases, complete the following actions to validate tokenization:

  1. Set up the account
  2. Simulate a credit card purchase
  3. Confirm data tokenization

Setting up the account

Enable tokenization on the headless account following the steps below:

  1. Ask the VTEX Payments team to enable the tokenization feature.
  2. Install the payment connector that will support tokenization operations on the account.

If you want, you can use a VTEX test connector to simulate tokenization operations. To do this, install the connector using the command vtex install vtex.fake-pay-io-connector@3.0.3 in the VTEX IO CLI.

  1. In the VTEX Admin, go to Store Settings > Payments > Providers, or type Providers in the search bar at the top of the page.
  2. On the providers page, click the New provider button.
  3. In the search bar, type the name of the installed connector and click it.
  4. Complete the information requested on the configuration screen and click Save.
  5. Set up a payment condition with a credit card.

Simulating a credit card purchase

Make a purchase using your credit card as described below:

  1. Follow the purchase steps up to the Placing the order in the guide Creating a regular order with the Checkout API.
  2. Send the payment data via the Send payments information endpoint (as described in the Resolving the order payment section of the guide), including the savePaymentData field in the request.

_11
[
_11
{
_11
...
_11
"fields": {
_11
"savePaymentData": true,
_11
"holderName": "John Doe",
_11
...
_11
}
_11
...
_11
}
_11
]

Confirming data tokenization

To confirm the card data was tokenized and saved correctly, follow the steps below:

  1. In the VTEX Admin, go to Orders > Transactions, or type Transactions in the search bar at the top of the page.
  2. Click the payment transaction for the purchase made in the previous section.
  3. On the Transaction events page, find the connector authorization response event and confirm that the generatedCardToken dataset is present, as shown in the following example:

_10
Authorization response received: [200 OK] {"status":"approved","authorizationId":"AC97443800154CA8950FA49DB8271EB4","nsu":null,"tid":"40b73bc2-ed66-4118-a6b6-1726c16332a6","acquirer":null,"delayToAutoSettle":3600,"isNewTokenization":true,"generatedCardToken":{"cardTokenType":"TOKEN_VALUE","cardTokenValue":"******","cardTokenExpiryMonth":"08","cardTokenExpiryYear":"2037","cardTokenHref":null,"cardTokenClientId":null,"tokenExtraData":null,"useCvvForAuthorization":false,"cardTokenCvv":null},"paymentId":"DA4B34B82A76497D86F69F2951F6C306","code":null,"message":"Card token payment has been approved"}

  1. Access the Get client profile by email endpoint and confirm if the accountId field is being returned correctly, as shown in the example below:

_14
{
_14
...
_14
"availableAccounts": [
_14
{
_14
"accountId": "ADA70C8D7321403510535172A6EFC3C5",
_14
"paymentSystem": "4",
_14
"paymentSystemName": "Mastercard",
_14
"cardNumber": "************1111",
_14
"bin": "111111",
_14
...
_14
}
_14
],
_14
"availableAddresses": {}
_14
}

The presence of the generatedCardToken dataset and the accountId field confirms the connector processed tokenization correctly and the token has been assigned to the buyer's profile.

Contributors
2
Photo of the contributor
Photo of the contributor
Was this helpful?
Yes
No
Suggest Edits (GitHub)
Contributors
2
Photo of the contributor
Photo of the contributor
Was this helpful?
Suggest edits (GitHub)
On this page