# Payer Token
source: https://developer.mastercard.com/open-finance-europe/documentation/unlicensed/aiia-pay/preview/payer-token/index.md

Aiia Pay provides for a `payerToken` to be generated as part of a Payment Request where Payment Service Users (PSU's) perform multiple transactions with a TPP. The `payerToken` can help the payer to a reduced payment journey and streamline the PSU's account selection journey.
Note: TPPs should only send a `payerToken` if the PSU has confirmed that they want to use the source account they used previously.

### How it works {#how-it-works}

1. A PSU initiates a transaction from their account through the TPP.
2. The TPP submits a request to Aiia Pay to generate a `payerToken` for the payment, which contains information about the source account used for the transaction.
3. The PSU authorizes the payment.
4. Aiia Pay generates an encrypted `payerToken` and sends it to the TPP.
5. The TPP stores the `payerToken`.
6. When the PSU initiates a subsequent payment, the TPP includes the `payerToken` within their payment request to Aiia Pay.
7. Aiia Pay uses the `payerToken` to pre-populate the source account in the payment request to the bank.

In summary, for subsequent requests the PSU is not asked to select their account at their bank.

### To link a payment account for the first time {#to-link-a-payment-account-for-the-first-time}

A request to create a `payerToken` is made using the `issuerPayerToken` parameter within the Payment Request.

|      **Name**      | **Type** |                                           **Description**                                           |
|--------------------|----------|-----------------------------------------------------------------------------------------------------|
| `issuerPayerToken` | boolean  | A `true` or `false` value to indicate that a `payerToken` will be created for this payment account. |

##### Example {#example}

Set `issuePayerToken` to `true` to request a `payerToken`:

```json
{
  "issuePayerToken": true,
  "payerToken": "<payer-token>",
  "providerId": "DemoBank",
  "providers": [ "DK" ],
}
```

#### Response {#response}

The returned `payerToken` can be located by calling **v2/payments/accept/{paymentId}/payer-token**.

```json
{
  "providerId": "DemoBank",
  "redactedAccountNumber": "1234 *******890",
  "expires": "2023-08-24T14:15:22.223+00:00",
  "payerToken": "<payer-token>"
}
```

The following sequence diagram shows the flow for requesting a `payerToken` .
Diagram link-payer-token

#### Subsequent times {#subsequent-times}

For subsequent requests, the `payerToken` is used to pre-populate the source account in the payment request to the bank.

|  **Name**  | **Type** |                                                    **Description**                                                     |
|------------|----------|------------------------------------------------------------------------------------------------------------------------|
| payerToken | `string` | Contains encrypted values about the source account. Used to pre-set values on the payment to shorten the payment flow. |

##### Example {#example-1}

Include the `payerToken` for subsequent requests:

```json
{
  "issuePayerToken": true,
  "payerToken": "<payer-token>",
  "providerId": "DemoBank",
  "providers": [ "DK" ],
}
```

The following sequence diagram shows the flow for subsequent calls using `payerToken`.
Diagram subsequent-payer-token
