> For the complete documentation index, see [llms.txt](https://patryqhyper.gitbook.io/polish_payments_api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://patryqhyper.gitbook.io/polish_payments_api/online-payments/simpay-direct-billing.md).

# SimPay direct billing

Base:

```php
$simpay = $payment->online(
    new SimPayDirectBillingPayment(
        'apiKey (not used anymore, you can pass anything)', 
        'apiPassword', 
        'serviceId', 
        'serviceHash'
    )
);
```

Generate payment:

```php
$simpay->setAmount(15.00); //required
//optional
$simpay->setDescription('description');
$simpay->setControl('control');
$simpay->setReturnFail('https://return.url/fail');
$simpay->setReturnSuccess('https://return.url/success');
$simpay->setPhoneNumber('phoneNumber');

$simpayPayment = $simpay->generatePayment();
$simpayPayment->getTransactionUrl();
$simpayPayment->getTransactionId();
```

Get IPN signature:

<pre class="language-php"><code class="lang-php">// Your code in IPN handler.

// example payload getter
$payload = json_decode(file_get_contents('php://input'), true);

<strong>$signature = $simpay->generateIpnSignature($payload);
</strong>
if(!hash_equals($signature, $payload['signature'])) {
    throw new \Exception('invalid signature');
}
</code></pre>
