PHP code example of unitpay / php-sdk

1. Go to this page and download the library: Download unitpay/php-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

unitpay / php-sdk example snippets





Unitpay\Model\CashItem;
use Unitpay\Unitpay;

$unitpay = new Unitpay('unitpay.ru', $secretKey);

$unitpay
    ->setBackUrl('https://domain.com')
    ->setCustomerEmail('[email protected]')
    ->setCashItems([new CashItem('Iphone 6 Skin Cover', 1, 900)]);

$redirectUrl = $unitpay->form($publicId, 900, $orderId, 'Payment for item', 'RUB');

header('Location: ' . $redirectUrl);