Skip to content

remils/tinkoff-acquiring-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tinkoff acquiring client

PHP client for Tinkoff REST API.

1 Requirements

  • PHP 7.1 or above

2 Installation

composer require 'sergey-zatulivetrov/tinkoff-acquiring-client'

3 Uses

3.1 Сonnection definition

use SergeyZatulivetrov\TinkoffAcquiring\Client;

$client = new Client();

3.1.1 Init connection

$client->init($data);

3.1.2 Confirm connection

$client->confirm($data);

3.1.3 Cancel connection

$client->cancel($data);

3.1.4 GetState connection

$client->getState($data);

3.1.5 Resend connection

$client->resend($data);

3.2 Data

3.2.1 Init data

3.2.1.1 Property
/**
 * Class InitData
 *
 * @property string  $TerminalKey
 * @property integer $Amount
 * @property string  $OrderId
 * @property string  $IP
 * @property string  $Description
 * @property string  $Language
 * @property string  $CustomerKey
 * @property string  $Recurrent
 * @property string  $RedirectDueDate
 * @property array   $DATA
 * @property string  $NotificationURL
 * @property string  $SuccessURL
 * @property string  $FailURL
 * @property string  $PayType
 * @property array   $Receipt
 */
 
/**
 * Class ReceiptData
 *
 * @property array  $Items
 * @property string $Email
 * @property string $Phone
 * @property string $EmailCompany
 * @property string $Taxation
 */
 
/**
 * Class ItemData
 *
 * @property string  $Name
 * @property integer $Price
 * @property float   $Quantity
 * @property integer $Amount
 * @property string  $PaymentMethod
 * @property string  $PaymentObject
 * @property string  $Tax
 * @property string  $Ean13
 * @property string  $ShopCode
 */
3.2.1.2 Example
use SergeyZatulivetrov\TinkoffAcquiring\InitData;
use SergeyZatulivetrov\TinkoffAcquiring\Constants\PaymentMethod;
use SergeyZatulivetrov\TinkoffAcquiring\Constants\PaymentObject;
use SergeyZatulivetrov\TinkoffAcquiring\Constants\Taxation;
use SergeyZatulivetrov\TinkoffAcquiring\Constants\Vat;
use SergeyZatulivetrov\TinkoffAcquiring\ItemData;
use SergeyZatulivetrov\TinkoffAcquiring\ReceiptData;

$data              = new InitData();
$data->TerminalKey = "TestB";
$data->Amount      = 140000;
$data->OrderId     = "21050";
$data->Description = "Подарочная карта на 1400.00 рублей";
$data->DATA        = [
    "Phone" => "+71234567890",
    "Email" => "[email protected]",
];

$item1                = new ItemData();
$item1->Name          = "Наименование товара 1";
$item1->Price         = 10000;
$item1->Quantity      = 1.00;
$item1->Amount        = 10000;
$item1->PaymentMethod = PaymentMethod::full_prepayment;
$item1->PaymentObject = PaymentObject::commodity;
$item1->Tax           = Vat::vat10;
$item1->Ean13         = "0123456789";

$item2                = new ItemData();
$item2->Name          = "Наименование товара 2";
$item2->Price         = 20000;
$item2->Quantity      = 2.00;
$item2->Amount        = 40000;
$item2->PaymentMethod = PaymentMethod::prepayment;
$item2->PaymentObject = PaymentObject::service;
$item2->Tax           = Vat::vat20;

$item3           = new ItemData();
$item3->Name     = "Наименование товара 3";
$item3->Price    = 30000;
$item3->Quantity = 3.00;
$item3->Amount   = 90000;
$item3->Tax      = Vat::vat10;

$receipt               = new ReceiptData();
$receipt->Email        = "[email protected]";
$receipt->Phone        = "+79031234567";
$receipt->EmailCompany = "[email protected]";
$receipt->Taxation     = Taxation::osn;
$receipt->Items        = [
    $item1->toArray(),
    $item2->toArray(),
    $item3->toArray(),
];
$data->Receipt         = $receipt->toArray();

3.2.2 Confirm data

3.2.2.1 Property
/**
 * Class ConfirmData
 *
 * @property string  $Token
 * @property string  $TerminalKey
 * @property integer $PaymentId
 * @property string  $IP
 * @property integer $Amount
 * @property array   $Receipt
 */
3.2.2.2 Example
use SergeyZatulivetrov\TinkoffAcquiring\ConfirmData;

$data = new ConfirmData();
$data->TerminalKey = "TinkoffBankTest";
$data->PaymentId   = "2164657";
$data->generateToken("password");

3.2.3 Cancel data

3.2.3.1 Property
/**
 * Class CancelData
 *
 * @property string  $Token
 * @property string  $TerminalKey
 * @property integer $PaymentId
 * @property string  $IP
 * @property integer $Amount
 * @property array   $Receipt
 */
3.2.3.2 Example
use SergeyZatulivetrov\TinkoffAcquiring\CancelData;

$data = new CancelData();
$data->TerminalKey = "TinkoffBankTest";
$data->PaymentId   = "2164657";
$data->generateToken("password");

3.2.4 GetState data

3.2.4.1 Property
/**
 * Class GetStateData
 *
 * @property string  $Token
 * @property string  $TerminalKey
 * @property integer $PaymentId
 * @property integer $Amount
 * @property string  $IP
 */
3.2.4.2 Example
use SergeyZatulivetrov\TinkoffAcquiring\GetStateData;

$data = new GetStateData();
$data->TerminalKey = "TinkoffBankTest";
$data->PaymentId   = "2164657";
$data->generateToken("password");

3.2.5 Resend data

3.2.5.1 Property
/**
 * Class ResendData
 *
 * @property string $Token
 * @property string $TerminalKey
 */
3.2.5.2 Example
use SergeyZatulivetrov\TinkoffAcquiring\ResendData;

$data = new ResendData();
$data->TerminalKey = "TinkoffBankTest";
$data->generateToken("password");

4 License

Copyright (c) Zatulivetrov Sergey. Distributed under the MIT.