> For the complete documentation index, see [llms.txt](https://docs.payrexx.com/merchant/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.payrexx.com/merchant/english/payment/functionalities/subcription/subscriptions-via-tokenization-api.md).

# Subscriptions Via Tokenization (API)

{% hint style="info" %}
The acronym "API" stands for Application Programming Interface. It refers to a set of commands, functions, and protocols that allow a software application to interact with another system.
{% endhint %}

## What is Tokenization?

Tokenization involves storing a payment method for future payments. You can learn about the benefits of tokenization and how to set it up in Payrexx in the following article:

{% content-ref url="/pages/-MdS2n8HP0jU5eXcYrrM" %}
[Tokenization](/merchant/english/payment/functionalities/tokenization.md)
{% endcontent-ref %}

Payrexx offers two ways to set up subscriptions:

1. [Payrexx-managed subscriptions](/merchant/english/payment/functionalities/subcription/subscriptions-managed-by-payrexx.md): Payrexx automatically handles charges, payment reminders, and customer notifications.
2. Subscriptions via tokenization: Processing is managed via the API, which is explained in this article.

## Who is the API method suitable for?

With the API option, you manage charges and notifications entirely yourself. This method is particularly suitable if:

* Your recurring payments do not follow a fixed schedule (varying intervals or timing)
* Your customers should not be bound by long-term commitments
* The amount to be billed is variable (e.g., pay-per-use)

{% hint style="info" %}
If your subscriptions are consistent in terms of timeframe, product, price, and payment method, the [Payrexx-managed option](/merchant/english/payment/functionalities/subcription/subscriptions-managed-by-payrexx.md) is generally recommended, as it can be set up without technical expertise.
{% endhint %}

## How Does It Work?

The process consists of three steps:

1. **Token Creation:** During the customer's initial interaction, a token is created via the Payrexx Gateway using the `preAuthorization` parameter instead of processing a one-time payment. Optionally, an initial charge can be triggered immediately afterward using the `chargeOnAuthorization` parameter.
2. **Retrieve Transaction ID:** Following authorization, you receive the corresponding transaction ID either via the Transaction Webhook or by querying the gateway via the API (status: `authorized`).
3. **Trigger Charge:** Using the transaction ID, you can charge custom amounts as often as needed via the endpoint for capturing pre-authorized transactions.

#### Key features of this method:

* A custom amount can be specified for each charge.
* There is no guarantee of success for an individual charge.
* Once created, a token does not expire.

## Technical Information

Technical information and instructions for enabling subscription payments through tokenization can be found in the relevant article in our developer documentation:

{% embed url="<https://docs.payrexx.com/developer/guides/gateway/payment-types/tokenization>" %}

## Frequently Asked Questions

<details>

<summary><strong>In which cases are the webhooks "Transaction" and "Subscription" triggered for subscriptions?</strong></summary>

* **Cancellation:** The "Subscription" webhook (status: cancelled) is triggered.
* **Updating a payment method:** The "Subscription" webhook with the new token data is triggered.
* **Charge:** The "Transaction" webhook is always triggered. If the charge is successful, the "Subscription" webhook is additionally triggered with the updated billing date (next\_pay\_date).

</details>

<details>

<summary><strong>Is it possible to cancel a subscription at the next expiration date via the API?</strong></summary>

No, the API only supports the immediate deletion of a subscription (DELETE). Cancellation effective at the end of the billing period can only be configured in the Payrexx merchant administration, not via the API.

</details>

<details>

<summary><strong>Is it possible to update a customer’s address data via the API?</strong></summary>

No, address data is tied to the payment process and cannot be updated independently via the API.

</details>

<details>

<summary><strong>When does Payrexx send confirmation emails?</strong></summary>

If the sending of confirmation emails is enabled under **Settings > Notifications**, Payrexx will send the emails. If the setting is disabled, Payrexx will not send any emails.

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.payrexx.com/merchant/english/payment/functionalities/subcription/subscriptions-via-tokenization-api.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
