PHP code example of chumakovanton / yii2-tinkoff-pay

1. Go to this page and download the library: Download chumakovanton/yii2-tinkoff-pay 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/ */

    

chumakovanton / yii2-tinkoff-pay example snippets


'components' => [
    //  ...
    'tinkoffPay' => [
            'class' => \chumakovanton\tinkoffPay\TinkoffPay::className(),
            'terminalKey' => 'terminalKey',
            'secretKey' => 'secretKey',
            'apiUrl' => 'https://securepay.tinkoff.ru/v2'
        ],
]



/** @var \chumakovanton\tinkoffPay\TinkoffPay $paymentService */
$paymentService = Yii::$app->tinkoffPay;

$paymentRequest = $paymentService->initPay('order1', 1000);

$paymentRequest->addData('user_id', 123);

try {
    $response = $paymentRequest->send();
} catch (\chumakovanton\tinkoffPay\exceptions\HttpException $exception) {
    throw new \yii\web\HttpException($exception->statusCode, $exception->getMessage());
}

$paymentUrl = $response->getPaymentUrl();


php composer.phar