# Tokenization

Create a **token** of a payment meanwhich can be used **multiple** times for **charges**.

* Set a **customisable amount** for each charge
* There is **no guarantee** for the successful **charge** of a tokenisation
* Tokenizations do **not expire**

{% hint style="warning" %}
Not all payment provider support tokenizations.\
Visit our [PSP Feature](https://docs.payrexx.com/merchant/bezahldienste/funktionsmatrix) list to find a suitable payment provider.
{% endhint %}

## Process

<figure><img src="/files/dNhp622C0YCugLUfwYhT" alt=""><figcaption></figcaption></figure>

### Gateway Creation

Tokenizations can easily be implemented using the Payrexx Gateway.\
When setting the parameter **preAuthorization,** your Gateway will process a tokenization instead of a one-time payment.

{% content-ref url="/pages/-Mguz7bjqS3lWfKhQ2HU" %}
[Build Your Gateway](/developer/guides/gateway/build.md)
{% endcontent-ref %}

{% hint style="info" %}
Use the parameter **chargeOnAuthorization** to execute an initial charge immediately after authorization.
{% endhint %}

### Customer Authorization

This step is identical to the "payment" step in the [Gateway documentation](/developer/guides/gateway/build.md#payment).\
With a tokenization, the only difference is that, a token creation takes place instead of a charge.

Also a [transaction webhook](broken://pages/-MdH-49ly2WkM5gq1xze) with the transaction status **authorized** will be triggered.

### Charge Tokenization

#### Get Transaction ID

The transaction ID is present in the [transaction Webhook](broken://pages/-MdH-49ly2WkM5gq1xze)*.*

You can find this ID also if you [retrieve a Gateway](https://developers.payrexx.com/reference#retrieve-a-gateway) through the Payrexx API.\
Small hint on where to find the transaction ID in the retrieve a Gateway respone:

```yaml
{
    "status": "success",
    "data": [
        {
            "id": 1,
            "status": "authorized",
            "invoices": [
                {
                    "transactions": [
                        {
                            "id": 2012844,
                        }
                    ],
                }
            ],
        }
    ]
}
```

#### Execute Charge

Use [Charge a Pre-Authorized/Reserved Transaction](https://developers.payrexx.com/reference-link/charge-a-pre-authorized-reserved-transaction) to make a charge on the authorized transaction.\
You will need the ID of the transaction with status **authorized** to do so!

{% hint style="success" %}
You can run as many charges with customizable amounts as you like
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.payrexx.com/developer/guides/gateway/payment-types/tokenization.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
