PHP code example of webtoucher / omnipay-interkassa

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

    

webtoucher / omnipay-interkassa example snippets


    $gateway = \Omnipay\Omnipay::create('InterKassa');
    $gateway->setCheckoutId('[CHECKOUT_ID]');
    $gateway->setSignKey('[SIGN_KEY]');

    $request = $gateway->purchase([
        'amount' => $amount,
        'currency' => 'UAH',
        'transactionId' => $orderId,
        'description' => "Some description (order $orderId)",
        'interface' => 'web',
        'action' => 'payway',
        'payway' => 'privat24_liqpay_merchant3_uah',
        'returnUrl' => "https://mydomain.com/payment/interkassa/success?order=$orderId",
        'returnMethod' => 'GET',
        'cancelUrl' => 'https://mydomain.com/payment/interkassa/cancel',
        'cancelMethod' => 'GET',
        'notifyUrl' => 'https://mydomain.com/payment/interkassa/notify',
        'notifyMethod' => 'POST',
    ]);
    $response = $request->send();
    if ($response->isRedirect()) {
        $response->redirect();
    }

    $request = $gateway->completePurchase($_POST);
    $response = $request->send();
    $orderId = $response->getTransactionId(); // You can check this order and mark it as paid.
    if ($response->isSuccessful()) {
        // Your handler
    } else {
        // Your handler
    }

$ php composer.phar