# Subscription

There are two different ways to use subscriptions.

* Payrexx managed recurring payments
* Self managed using a tokenization

{% hint style="warning" %}
Not all payment provider support subscriptions & tokenizations.\
Visit our [PSP Feature](https://help.payrexx.com/payment/payment-provider/psp-features) article to find a suitable payment provider.
{% endhint %}

## Payrexx Managed

We will debit your customer's payment mean based on your details.

### Gateway Creation

Payrexx managed subscriptions can easily be implemented using the Gateway.\
Use the following parameters to perform a subscription via the gateway

* subscriptionState: Set to true for subscriptions
* subscriptionInterval: Payment interval
* subscriptionPeriod: Duration of the subscription
* subscriptionCancellationInterval: Cancellation possibility for your customer

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

{% hint style="info" %}
If youn choose Payrexx managed subscriptions, you will receive a [subscription Webhook](broken://pages/-MdH-TXLfrfkE83U3pAR) instead of a [transaction Webhook](broken://pages/-MdH-49ly2WkM5gq1xze).
{% endhint %}

## Self Managed

With this type of subscription, you are responsible for the individual charges of the subscription. Tokenization is the toolbox that helps you to do this.

### Setup Tokenization

Use the instructions from the Tokenization documentation for the setup.

{% content-ref url="/pages/-McyiEbATEMXrthqhcPE" %}
[Tokenization](/developer/guides/gateway/payment-types/tokenization.md)
{% endcontent-ref %}

### Example

Once you have an authorized Transaction you can make charges using this tokenization.

**Example**\
Subscription Interval: 1 month\
Subscription preiod: 1 year

Make a charge every month for one year.\
You can find out how charges work in the [tokenization documentation](/developer/guides/gateway/payment-types/tokenization.md).

{% hint style="warning" %}
You must implement the logic for **cancellations**, **renewals** etc.\
This allows you unlimited customisability!

Tokenization charges may fail due to different reasons.\
Make sure to handle this case in your code!
{% 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/subscriptions.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.
