Skip to main content
To tokenize your shopper’s payment details, you need to include additional fields when you make an API request to create a payment session or make a payment. When the details are successfully tokenized, you receive a webhook that contains the token you can use for subsequent payments. You can tokenize your shopper’s payment details when they pay for a purchase, or with a zero-value auth. If you already have existing recurring contracts with another payment service provider, you can import the stored payment details to Adyen.

Requirements

Before you begin, take into account the following requirements, limitations, and preparations.

How it works

To store your shoppers payment details and get a token that you can use for future payments:
  1. Enable the Recurring tokens life cycle events webhook.
  2. Before the shopper pays on your website or app, ask for their consent to store their payment details for future payments. You must inform the shopper about the payment schedule and the amount that you will charge to reduce the risk of chargebacks.
  3. In your payment request, include tokenization parameters to create a token with the shopper’s payment details. Multiple endpoints support tokenizing your shopper’s payment details:
    • POST /sessions: the simplest way to create tokens. The payment session contains all the information needed to collect payment details securely. This reduces your PCI scope to the simplest level (SAQ A).
    • POST /payments: lets you have more control over the checkout experience, and lets you handle more complex payment flows where you need to manage the state and data flow yourself.
    • POST /storedPaymentMethods: Only available on Checkout API v70 and later. Lets you create tokens without an authorization. We recommend to create tokens with an authorization, to make sure the tokens you create are linked to active, chargeable accounts.
  4. After the transaction is authorized, get the unique identifier and other information about the token from the recurring.token.created webhook.

Enable the webhook

To get updates when a token is created, updated, or disabled, enable the Recurring tokens life cycle events webhook. This webhook includes:
  • data.storedPaymentMethodId: the ID of the token that was created, updated, or disabled.
  • data.shopperReference:: your unique shopper reference.
  • eventId: the pspReference for the transaction made to store the shopper’s payment details.
  • type: the type of webhook. The table below lists the possible values.
We recommend that you set up the webhook with all default events. Example token created webhook
We are no longer working on the development of the RECURRING_CONTRACT webhook. We strongly recommend to use the new Recurring tokens life cycle events webhook instead, because it keeps you informed of more token lifecycle events. If your integration already uses the RECURRING_CONTRACT webhook, the webhook remains available.

Create a token

Select the endpoint you are using:
When the shopper proceeds to make a payment:
  1. Use your integration to create a session. In your /sessions request, include the additional parameters for tokenization:
  2. If you want to tokenize the shopper’s payment details with a zero-value auth, set the amount.value to 0. If you want to tokenize the payment details as part of another transaction, use the amount for the current transaction. Some payment methods, like iDEAL do not allow 0, and require a minimum amount. Example /sessions request to create a CardOnFile token

    curl

    Java

    PHP

    C#

    Go

    Python

    Ruby

    NodeJS (TypeScript)

    The token is created after a successful payment authorization to ensure that the payment details the shopper provided are linked to an active, chargeable account. The token will be linked to the shopperReference you provided in your /sessions request. If you have previously used the sameshopperReference value, the token will be associated with the existing shopper. Example response after the request to create a token
  3. Depending on the recurringProcessingModel, Strong Customer Authentication (SCA) may be required. The /sessions endpoint supports native 3D Secure authentication.
    • CardOnFile: regulations and scheme rules may require SCA.
    • Subscription and UnscheduledCardOnFile: SCA is required for the initial payment.
  4. Get the token you can use for future payments in an asynchronous Recurring tokens life cycle events webhook with type: recurring.token.created.