PHP code example of leonardjke / omnipay-qiwi

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

    

leonardjke / omnipay-qiwi example snippets


/** @var P2PGateway $gateway */
$gateway = Omnipay::create('Qiwi_P2P');

$gateway->initialize([
    'public_key' => 'user-public-key',
    'secret_key' => 'user-private-key',
]);

$gateway->setCustomFields(['themeCode' => 'codeStyle']);

$gateway->setSuccessUrl('https://example.com/page-to-return-after-complete');

/** @var P2PGateway $gateway */
$gateway = Omnipay::create('Qiwi_P2P');

$gateway->initialize([
    'public_key' => 'user-public-key',
    'secret_key' => 'user-private-key',
    'success_url' => 'https://example.com/page-to-return-after-complete',
    'custom_fields' => ['themeCode' => 'customCodeStyle'],
]);

/** @var P2PGateway $gateway */
$gateway = Omnipay::create('Qiwi_P2P');

$gateway->initialize([
    'public_key' => 'user-public-key',
    'secret_key' => 'user-private-key',
]);

/** @var NotificationRequest $gateway */
$response = $gateway->acceptNotification();

// Check request signature
if (!$response->isValid()) {
    return 'error message';
}

// Status from NotificationInterface
$status = $response->getTransactionStatus();

$amount = $response->getAmount();
$message = $response->getMessage();
$currency = $response->getCurrency();
$transactionId = $response->getTransactionId();
$transactionReference = $response->getTransactionReference();