# Create BLIK subscription

{% hint style="info" %}
To understand how BLIK subscriptions work please see [https://docs.simpay.pl/en/payment/blik-recurrent](https://docs.simpay.pl/en/payment/blik-recurrent#creating-a-subscription)
{% endhint %}

At first you need to generate transaction:

```php
// only required fields are shown
$payment = SimPay::payment()->generate()
    ->amount(15.00) // you may create subscription with amount set to 0.00, then it will work as authorization to future recurrent payments
    ->customer(
        new \SimPay\Laravel\Dto\Payment\CustomerData(
            email: 'Email',
            ip: 'IP address',
            countryCode: 'PL', // for BLIK it must be PL
        )
    )
    ->antifraud(
        new \SimPay\Laravel\Dto\Payment\AntiFraudData(
            userAgent: 'UserAgent (REQUIRED)',
            systemId: 'Payer identifier in your platform (eg. user id, hashed email)',
        )
    )
    ->currency('PLN')
    ->directChannel('blik-recurrent') // it must be set to blik-recurrent
    ->make();
```

Now register subscription:

```php
$subscription = SimPay::payment()->subscriptions()->createBlik()
    ->transaction($payment) // you may pass full TransactionGenerateResponse or just transactionId
    ->ticket(new \SimPay\Laravel\Dto\Payment\Subscription\BlikTicketData(
        ticket: 'BLIK_CODE',
        ticketType: \SimPay\Laravel\Enums\Payment\BlikLevel0TicketType::T6,
    ))
    ->alias(new \SimPay\Laravel\Dto\Payment\Subscription\BlikAliasData(
        value: 'ALIAS VALUE (eg. subscription id)',
        label: 'Alias label (shown in payers bank app)',
        type: \SimPay\Laravel\Enums\Payment\BlikAlias\BlikAliasType::PAYID, // Must be set to PAYID
    ))
    ->options(new \SimPay\Laravel\Dto\Payment\Subscription\BlikSubscriptionOptionData(
        model: \SimPay\Laravel\Enums\Payment\Subscription\BlikModel::A // A, O or M
        // see what fields are required to sent with each model: https://docs.simpay.pl/en/payment/blik-recurrent#creating-a-subscription
        expiresAt: 'string|Carbon|null',
        frequency: 'string|null',
        amountLimitPerTransaction: 'float|null',
        initiationDate: 'string|Carbon|null',
        amountLimitTotal: 'float|null',
        transactionsCountLimit: 'int|null'
    ))
    // optional fields
    ->description('383172 Pro plan in September')
    ->appUrl('mobile app url')
    // make() is required to create subscription
    ->make();
```

Response will be [BlikSubscriptionCreatedResponse](/simpay-laravel/payments/responses/bliksubscriptioncreatedresponse.md) or thrown SimPayException (see [Exceptions](/simpay-laravel/exceptions.md)).


---

# 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://simpaypl.gitbook.io/simpay-laravel/payments/subscriptions/create-blik-subscription.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.
