> For the complete documentation index, see [llms.txt](https://simpaypl.gitbook.io/simpay-laravel/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://simpaypl.gitbook.io/simpay-laravel/payments/transactions/blik-level-0.md).

# BLIK Level 0

At first you need to generate transaction:

```php
// only required fields are shown
$payment = SimPay::payment()->generate()
    ->amount(15.00)
    ->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)',
        )
    )
    ->currency('PLN')
    ->directChannel('blik-level0') // it must be set to blik-level0
    ->make();
```

Now make Level 0 call:

```php
try {
    $success = SimPay::payment()->blikLevel0()
    ->ticket('111222') // BLIK code
    ->ticketType(\SimPay\Laravel\Enums\Payment\BlikLevel0TicketType::T6) // for now, only T6 codes are supported
    ->transaction($payment) // you may pass full TransactionGenerateResponse or just transactionId
    ->make();
}
catch(\SimPay\Laravel\Exceptions\BlikLevel0\InvalidBlikTicketException $exception) {
    // notify user that BLIK ticket is not valid
    
    // you can also get errorCode returned from our API:
    $exception->errorCode;
}
catch(\SimPay\Laravel\Exceptions\SimPayException $exception) {
    // other error
    
    // you can also get errorCode returned from our API:
    $exception->errorCode;
}

```

ticketType() accepts an [BlikLevel0TicketType](/simpay-laravel/payments/enums/bliklevel0tickettype.md)  enum.

If ticket has been accepted, $success will be true.

**WARNING**: This does not mean that transaction is finished, you still need to listen to our IPN messages.

If ticket code is not valid, two exceptions may be thrown:

* \SimPay\Laravel\Exceptions\BlikLevel0\InvalidBlikTicketException
* \SimPay\Laravel\Exceptions\SimPayException

<br>
