﻿# Tokenization

## 1. Business Introduction

With the user's consent, you can safely store a bank card or bind a wallet account for the user. In subsequent payments, users can choose the stored card or bound payment method to experience a faster payment process.

PayerMax will safely store these bound payment information and generate tokens. When the user makes subsequent payments, you use the token to initiate a payment request to PayerMax.

## 2. Advantages of Tokenization

- Storing the user's payment information for the first payment can provide users with a faster repurchase experience;

- No need for PCI DSS certification, you can store the user's bank card at the cashier by managing Tokens;

- Provides a better solution for you to build your own cashier.

## 3. Token Generation Method

In the payment scenario, bind. For bank cards, store the card information after the payment is successful. For wallets, jump to the wallet page first to authorize the binding, and the payment is automatically completed after the binding is successful.

```mermaid
%%{init: {
  'theme': 'base',
  'themeVariables': {
    'primaryColor': '#e6f0ff',
    'primaryTextColor': '#333',
    'primaryBorderColor': '#5b9bd5',
    'lineColor': '#888',
    'actorMargin': 40,
    'noteBkgColor': '#0056b3',
    'noteTextColor': '#ffffff',
    'noteBorderColor': '#004a99'
  }
}}%%
sequenceDiagram
    participant Merchant as Merchant
    participant Frontend as PayerMax Frontend
    participant Server as PayerMax Server

    %% 1. Ordering Phase
    Merchant->>Server: 1.1 Place order
    Server-->>Merchant: 1.2 Return URL/Address

    %% 2. Payment and Authentication Phase
    Merchant->>Frontend: 2.1 Redirect to
PayerMax Frontend
    Frontend->>Frontend: 2.2 User fills in
payment info & authenticates
    Frontend->>Server: 2.3 Initiate payment
    Server->>Server: 2.4 Complete payment and generate token
    Server-->>Frontend: 2.5 Return payment result

    %% 3. Redirection and Notification
    Frontend->>Merchant: 2.6 Redirect to merchant result page
    Server->>Merchant: 2.7 Asynchronous notification of payment result and token
```

## 4. Supported Payment Methods

| Country and Region | Payment Method | Target Organization/Card Organization |
| ------------------ | -------------- | ------------------------------------- |
| All countries      | CARD           | All card groups                       |

## 5. Supported integration modes

PayerMax supports multiple integration modes, including **`Cashier Payment`**, **`Direct-API Payment`**, **`Drop In Payment`**.

(a) For the first payment, you can choose the integrated mode for payment authorization:

- [Cashier mode](https://docs.payermax.com/en/202606-version/receipt/tokenization/cashier.md): Jump to the PayerMax cashier to select the payment method, enter the payment elements and complete the payment;

- [Direct-API mode](https://docs.payermax.com/en/202606-version/receipt/tokenization/direct-api.md): Use API interaction for the first payment to specify the payment method and payment element information;

- [Drop In mode](https://docs.payermax.com/en/202606-version/receipt/tokenization/frontend-component.md): Using PayerMax's pre-built payment UI solution, merchants can embed the component anywhere on the product page, and the component renders the payment method and collects the payment elements.

(b) Subsequent use of Token to directly initiate payment.
