> For the complete documentation index, see [llms.txt](https://docs.payrexx.com/developer/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/developer/guides/gateway/payment-types/subscriptions.md).

# Subscription

There are two different ways to use subscriptions.

* Payrexx managed recurring payments
* Self-managed using a tokenization

{% hint style="warning" %}
Not all payment providers support subscriptions & tokenizations. Visit our [PSP Feature](https://docs.payrexx.com/merchant/english/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 be implemented easily 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 you choose Payrexx managed subscriptions, you will receive a [subscription Webhook](/developer/guides/webhook/subscription.md) instead of a [transaction Webhook](/developer/guides/webhook/transaction.md).
{% 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 period: 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 %}
