# 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>


---

# 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/transactions/blik-level-0.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.
