---
id: create-token
title: Creating a token
hide_title: true
description: "Creation of a customer-token"
---

import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
import Ingress from "../../../src/components/ingress/ingress.react";

<Ingress title="Creating a token">
  To create a customer token for tokenized payments, the customer must first use the Walley
  Checkout to select a payment method and give consent to charge for future payments.
</Ingress>

## Creating a customer token

To enable customer token creation, your Walley Checkout must be configured in **tokenization mode**. Please contact **Walley Merchant Services** to enable tokenization for you.

### Tokenization modes

There are two supported modes for tokenization:

#### 1. Subscription mode

- The checkout interface will change to show relevant information for a subscription instead of a regular payment.
- The cart is **optional**:
  - If the cart is omitted or the total is **zero**, no order is created.
  - If the cart total is **greater than zero**, an initial payment is processed as part of the subscription.

#### 2. Token registration mode

- The checkout interface will change to show relevant information for a token registration instead of a regular payment.
- The cart **must be omitted**, as no payment is made during token registration.

### Retrieving the customer token

After the customer completes the checkout, you can retrieve the customer token using the [Get Checkout Information](/docs/checkout/getcheckoutinformation) endpoint.
The response contains the field `data.order.customerToken` which you can use for future [authorizations](/docs/checkout/tokenization/authorization).

### Flowchart

<div>
    ```mermaid
    ---
        config:
            flowchart:
                wrappingWidth: 2000
    ---
    flowchart LR
        subgraph A[" "]
            A1["Initialize a checkout session in tokenization mode:<br/>- Subscription Mode (cart optional)<br/>- Token Registration Mode (no cart)"]
            A2["Customer completes Checkout and gives consent"]
            A3["Merchant calls Get Checkout Information<br/>Read: data.order.customerToken"]
            A4[("Store CustomerToken")]
            A5(["Proceed to Authorization"])
            A1 --> A2 --> A3 --> A4 --> A5
    end
    ```
</div>