PHP code example of interkassa / php-sdk

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

    

interkassa / php-sdk example snippets






$configuration = new \Interkassa\Helper\Config();
$configuration->setCheckoutSecretKey('5rkFvckBLKcDHQrW');
$configuration->setAuthorizationKey('TpIJabcdefgdtNabcdefgMCeYvdVkF');
$configuration->setAccountId('ffa001aaaa00000000001234');

$SDKClient = new \Interkassa\Interkassa($configuration);

$invoiceRequest = new \Interkassa\Request\GetInvoiceRequest();
$invoiceRequest
    ->setCheckoutId('5fa005a06a00000000001234')
    ->setPaymentNumber('ID_1234')
    ->setAmount('100')
    ->setCurrency('UAH')
    ->setDescription('Payment Description');

$url = $SDKClient->makeInvoiceSciLink($invoiceRequest);
$SDKClient->redirect($url);

$invoiceRequest = new \Interkassa\Request\PostInvoiceRequest();
$invoiceRequest
    ->setCheckoutId('5fa005a06a00000000001234')
    ->setPaymentNumber('ID_1234')
    ->setAmount('100')
    ->setCurrency('UAH')
    ->setDescription('Payment Description')
    ->setAction('process')
    ->setPaywayVia('test_interkassa_test_xts');

$result = $SDKClient->makeInvoicePaySystemLink($invoiceRequest);

$code = $result->getCode();
$status = $result->getStatus();
$message = $result->getMessage();
$data = $result->getData();

$html = $SDKClient->redirectForm($data);
echo $html;

$invoiceRequest = new \Interkassa\Request\CalculateRequest();
$invoiceRequest
    ->setCheckoutId('5fa005a06a00000000001234')
    ->setPaymentNumber('ID_1234')
    ->setAmount('100')
    ->setCurrency('UAH')
    ->setDescription('Payment Description')
    ->setAction('payway')
    ->setPaywayVia('test_interkassa_test_xts');

$result = $SDKClient->calculateInvoice($invoiceRequest);

$code = $result->getCode();
$status = $result->getStatus();
$message = $result->getMessage();
$data = $result->getData();

$invoiceRequest = new \Interkassa\Request\PaymentDirectionsRequest();
$invoiceRequest
    ->setCheckoutId('5fa005a06a00000000001234')
    ->setPaymentNumber('ID_1234')
    ->setAmount('100')
    ->setCurrency('UAH')
    ->setDescription('Payment Description')
    ->setAction('payways');
    ->setPaymentMethod('visa')
    ->setPaymentCurrency('USD');

$result = $SDKClient->getPaymentDirection($invoiceRequest);

$code = $result->getCode();
$status = $result->getStatus();
$message = $result->getMessage();
$data = $result->getData();

$result = $SDKClient->getCurrencyList();

$code = $result->getCode();
$status = $result->getStatus();
$data = $result->getData();

$result = $SDKClient->getCurrencyById('30');

$code = $result->getCode();
$status = $result->getStatus();
$data = $result->getData();

$result = $SDKClient->getPaysystemInputPaywayList();

$code = $result->getCode();
$status = $result->getStatus();
$data = $result->getData();

$result = $SDKClient->getPaysystemInputPaywayById('11a001111100000000001234');

$code = $result->getCode();
$status = $result->getStatus();
$data = $result->getData();

$result = $SDKClient->getPaysystemOutputPaywayList();

$code = $result->getCode();
$status = $result->getStatus();
$data = $result->getData();

$result = $SDKClient->getPaysystemOutputPaywayById('11a001111100000000004321');

$code = $result->getCode();
$status = $result->getStatus();
$data = $result->getData();

$result = $SDKClient->getAccountList();

$code = $result->getCode();
$status = $result->getStatus();
$data = $result->getData();

$result = $SDKClient->getAccountById('ffa001aaaa00000000001234');

$code = $result->getCode();
$status = $result->getStatus();
$data = $result->getData();

$result = $SDKClient->getCheckoutList();

$code = $result->getCode();
$status = $result->getStatus();
$data = $result->getData();

$result = $SDKClient->getCheckoutById('11a002222200000000004321');

$code = $result->getCode();
$status = $result->getStatus();
$data = $result->getData();

$result = $SDKClient->getAllInvoices();

$code = $result->getCode();
$status = $result->getStatus();
$data = $result->getData();

$result = $SDKClient->getInvoiceById('134001234');

$code = $result->getCode();
$status = $result->getStatus();
$data = $result->getData();

$result = $SDKClient->getWithdrawList();

$code = $result->getCode();
$status = $result->getStatus();
$data = $result->getData();

$result = $SDKClient->getWithdrawById('15001234');

$code = $result->getCode();
$status = $result->getStatus();
$data = $result->getData();

$result = $SDKClient->getPurseList();

$code = $result->getCode();
$status = $result->getStatus();
$data = $result->getData();

$result = $SDKClient->getPurseList([
   'checkoutId' => '11a002222200000000004321',
   'currency' => '20'
]);

$code = $result->getCode();
$status = $result->getStatus();
$data = $result->getData();

$result = $SDKClient->getPurseById('404300001234');

$code = $result->getCode();
$status = $result->getStatus();
$data = $result->getData();

$refundRequest = new \Interkassa\Request\RefundRequest();
$refundRequest
    ->setId('134001234')
    ->setAmount('15')
    ->setDescription('Reason of the refund');
$result = $SDKClient->makeRefund($refundRequest);

$code = $result->getCode();
$status = $result->getStatus();
$data = $result->getData();

$withdrawRequest = new \Interkassa\Request\WithdrawRequest();
$withdrawRequest
    ->setAmount('15')
    ->setMethod('card')
    ->setCurrency('uah')
    ->setAction('process')
    ->setDetail('card', '5100123412341234')
    ->setPurseId('300000912345')
    ->setUseShortAlias('true');
$result = $SDKClient->makeWithdraw($withdrawRequest);

$code = $result->getCode();
$status = $result->getStatus();
$data = $result->getData();
cmd
composer 
cmd
git clone https://github.com/interkassa/php-sdk.git