Default icon

Tokenization

Store and use stored payment details with our tokenization feature with Hosted Checkout.

View source

You can store your shoppers' payment details so that they can pay without entering their payment details again. Storing payment details creates an associated token that can be used for subsequent payments.

Because the Hosted Checkout page handles the complete payment flow on an Adyen-hosted page, you have minimal PCI DSS requirements. This qualifies you for the simplest form of PCI validation (SAQ A).

You can:

Requirements

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

Requirement Description
Integration type A standard integration.
API credential roles Make sure that you have the following roles:
  • Checkout webservice role
  • Merchant Recurring role
Webhooks Subscribe to the Recurring tokens life cycle events webhook type.
Setup steps Before you begin:

How it works

The following diagrams show the flow for storing payment details and making a one-click payment.

Storing payment details:

  1. The shopper chooses to go to checkout on your website/app.
  2. Your server creates a payment session with additional tokenization parameters. Adyen returns the URL to the Hosted Checkout page.
  3. Your website/app redirects the shopper to the Hosted Checkout page.
  4. The shopper selects their payment method, consents to store their payment details, and completes the payment on the Hosted Checkout page.
  5. Adyen authorizes the payment and creates a token for the shopper's payment details.
  6. The shopper gets redirected to your website/app.
  7. Your webhook server receives a webhook message with the token associated with the shopper's stored payment details.
  8. You store the token and the shopper reference in your database.
CnNlcXVlbmNlRGlhZ3JhbQogICAgcGFydGljaXBhbnQgU2hvcHBlcgogICAgcGFydGljaXBhbnQgWW91ciB3ZWJzaXRlL2FwcAogICAgcGFydGljaXBhbnQgWW91ciBwYXltZW50IHNlcnZlcgogICAgcGFydGljaXBhbnQgQWR5ZW4gYXMgQWR5ZW4gc2VydmVyL0hvc3RlZCBDaGVja291dCBwYWdlCiAgICBwYXJ0aWNpcGFudCBZb3VyIHdlYmhvb2sgc2VydmVyCgogICAgU2hvcHBlci0+PllvdXIgd2Vic2l0ZS9hcHA6IDEuIEdvIHRvIGNoZWNrb3V0CiAgICBZb3VyIHdlYnNpdGUvYXBwLT4+WW91ciBwYXltZW50IHNlcnZlcjogVHJpZ2dlciBzZXNzaW9uIGNyZWF0aW9uIHJlcXVlc3QKICAgIFlvdXIgcGF5bWVudCBzZXJ2ZXItPj5BZHllbjogMi4gQ3JlYXRlIHBheW1lbnQgc2Vzc2lvbiB3aXRoIHRva2VuaXphdGlvbiBwYXJhbWV0ZXJzIChQT1NUIC9zZXNzaW9ucykKICAgIEFkeWVuLS0+PllvdXIgcGF5bWVudCBzZXJ2ZXI6IEhvc3RlZCBDaGVja291dCBwYWdlIFVSTAogICAgWW91ciBwYXltZW50IHNlcnZlci0tPj5Zb3VyIHdlYnNpdGUvYXBwOiBQYXNzIEhvc3RlZCBDaGVja291dCBwYWdlIFVSTAogICAgWW91ciB3ZWJzaXRlL2FwcC0+PkFkeWVuOiAzLiBSZWRpcmVjdCBzaG9wcGVyIHRvIEhvc3RlZCBDaGVja291dCBwYWdlCiAgICBTaG9wcGVyLT4+QWR5ZW46IDQuIFNlbGVjdCBwYXltZW50IG1ldGhvZCwgY29uc2VudCB0byBzdG9yZSBkZXRhaWxzLCBhbmQgY29tcGxldGUgcGF5bWVudAogICAgQWR5ZW4tPj5BZHllbjogNS4gQXV0aG9yaXplIHBheW1lbnQgYW5kIGNyZWF0ZSB0b2tlbgogICAgQWR5ZW4tPj5Zb3VyIHdlYnNpdGUvYXBwOiA2LiBSZWRpcmVjdCBzaG9wcGVyIHRvIHlvdXIgd2Vic2l0ZS9hcHAKICAgIEFkeWVuLT4+WW91ciB3ZWJob29rIHNlcnZlcjogNy4gV2ViaG9vayBtZXNzYWdlIHdpdGggdG9rZW4gKHJlY3VycmluZ1Rva2VuQ3JlYXRlZCkKICAgIFlvdXIgd2ViaG9vayBzZXJ2ZXItPj5Zb3VyIHdlYmhvb2sgc2VydmVyOiA4LiBTdG9yZSB0b2tlbiBhbmQgc2hvcHBlciByZWZlcmVuY2UK

Making a one-click payment:

  1. The shopper chooses to go to checkout on your website/app.
  2. Your server creates a payment session with additional tokenization parameters. Adyen returns the URL to the Hosted Checkout page.
  3. Your website/app redirects the shopper to the Hosted Checkout page. The Hosted Checkout page shows the shopper's stored payment details.
  4. The shopper selects their stored payment method and completes the payment on the Hosted Checkout page.
  5. The shopper gets redirected to your website/app.
  6. Your webhook server receives a webhook message with the outcome of the payment.
CnNlcXVlbmNlRGlhZ3JhbQogICAgcGFydGljaXBhbnQgU2hvcHBlcgogICAgcGFydGljaXBhbnQgWW91ciB3ZWJzaXRlL2FwcAogICAgcGFydGljaXBhbnQgWW91ciBwYXltZW50IHNlcnZlcgogICAgcGFydGljaXBhbnQgQWR5ZW4gYXMgQWR5ZW4gc2VydmVyL0hvc3RlZCBDaGVja291dCBwYWdlCiAgICBwYXJ0aWNpcGFudCBZb3VyIHdlYmhvb2sgc2VydmVyCgogICAgU2hvcHBlci0+PllvdXIgd2Vic2l0ZS9hcHA6IDEuIEdvIHRvIGNoZWNrb3V0CiAgICBZb3VyIHdlYnNpdGUvYXBwLT4+WW91ciBwYXltZW50IHNlcnZlcjogVHJpZ2dlciBzZXNzaW9uIGNyZWF0aW9uIHJlcXVlc3QKICAgIFlvdXIgcGF5bWVudCBzZXJ2ZXItPj5BZHllbjogMi4gQ3JlYXRlIHBheW1lbnQgc2Vzc2lvbiB3aXRoIHRva2VuaXphdGlvbiBwYXJhbWV0ZXJzIChQT1NUIC9zZXNzaW9ucykKICAgIEFkeWVuLS0+PllvdXIgcGF5bWVudCBzZXJ2ZXI6IEhvc3RlZCBDaGVja291dCBwYWdlIFVSTAogICAgWW91ciBwYXltZW50IHNlcnZlci0tPj5Zb3VyIHdlYnNpdGUvYXBwOiBQYXNzIEhvc3RlZCBDaGVja291dCBwYWdlIFVSTAogICAgWW91ciB3ZWJzaXRlL2FwcC0+PkFkeWVuOiAzLiBSZWRpcmVjdCBzaG9wcGVyIHRvIEhvc3RlZCBDaGVja291dCBwYWdlIChzaG93cyBzdG9yZWQgcGF5bWVudCBtZXRob2RzKQogICAgU2hvcHBlci0+PkFkeWVuOiA0LiBTZWxlY3Qgc3RvcmVkIHBheW1lbnQgbWV0aG9kIGFuZCBjb21wbGV0ZSBwYXltZW50CiAgICBBZHllbi0+PllvdXIgd2Vic2l0ZS9hcHA6IDUuIFJlZGlyZWN0IHNob3BwZXIgdG8geW91ciB3ZWJzaXRlL2FwcAogICAgQWR5ZW4tPj5Zb3VyIHdlYmhvb2sgc2VydmVyOiA2LiBXZWJob29rIG1lc3NhZ2Ugd2l0aCBwYXltZW50IG91dGNvbWUK

Store payment details

To store your shopper's payment details and get a token that you can use for future payments:

  1. Before the shopper pays on your website, ask for their consent to store their payment details for future payments.
  2. Create a session with tokenization parameters.
  3. Get the token from the webhook.

Create a session with tokenization parameters

When the shopper proceeds to make a payment, create a session and include the following additional parameters for tokenization:

Parameter Required Description
shopperInteraction Required Indicates the sales channel through which the shopper gives their card details. Set to Ecommerce.
recurringProcessingModel Required The type of recurring payment the token is intended for. Set to CardOnFile.
storePaymentMethodMode Required Indicates if the shopper's payment details will be stored.
Possible values:
  • askForConsent: The payment form shows a checkbox that the shopper can select to store their payment details. We create an associated token.
  • enabled: Store the payment details and create an associated token, without showing a checkbox in the payment form.

To store the shopper's payment details without collecting a payment, you can use a zero-value authorization: set the amount.value to 0 to verify the payment details. If you want to store the payment details as part of an actual transaction, use the amount for the current transaction.

Some payment methods, like iDEAL, require a minimum amount more than 0.

The token is created after a successful payment authorization to ensure that the shopper's payment details are linked to an active account that can be charged.

Get the token from the webhook

After the transaction is authorized, you receive a recurring.token.created webhook with the token you can use for future payments. Store the storedPaymentMethodId together with the shopperReference, so that you associate the token with the shopper.

To receive these updates, enable the Recurring tokens life cycle events webhook. We recommend that you set up the webhook with all default events.

Make a one-click payment

After you have stored a shopper's payment details, you can use the token for one-click payments where the returning shopper uses their stored payment details for a faster checkout.

  1. From your server, make a POST /sessions request including:

    Parameter Required Description
    shopperReference Required Your unique identifier for the shopper. We use it to check if you have stored payment details associated with this shopper.
    shopperInteraction Required Indicates the sales channel through which the shopper uses the stored payment details. Set to Ecommerce.
    recurringProcessingModel Required The type of recurring payment. Set to CardOnFile. If you set this to any other value, we internally change it to CardOnFile.

    If you use 3D Secure for PSD2 SCA compliance, some issuing banks require SCA for ContAuth with CardOnFile transactions. See the PSD2 SCA compliance guide for more information.

  2. Redirect the shopper to the Hosted Checkout page. The page shows the shopper's stored payment details.

  3. The shopper selects their stored payment method and completes the payment on the Hosted Checkout page.

  4. Get the outcome of the payment in a webhook message.

Test and go live

Follow our testing guide for tokenization and make sure that you can successfully store payment details and make payments with a token.

When you are ready to go live: