9951 explained code solutions for 126 technologies


php-omnipayHow can I use Omnipay Qiwi to process payments in my PHP application?


Omnipay Qiwi is a payment processing library for PHP applications that allows you to accept payments through Qiwi. It provides an easy-to-use interface for integrating with Qiwi's API.

To use Omnipay Qiwi in your PHP application, you will first need to install the library using Composer:

composer require league/omnipay omnipay/qiwi

Once the library is installed, you can create an instance of the gateway and set the parameters needed to process payments:

$gateway = Omnipay::create('Qiwi');
$gateway->setWalletId('1234567890');
$gateway->setSecret('1234567890');

You can then use the gateway to process payments:

$response = $gateway->purchase([
    'amount' => '10.00',
    'currency' => 'USD',
    'transactionId' => '123456',
    'returnUrl' => 'https://example.com/return',
])->send();

if ($response->isSuccessful()) {
    // Payment was successful
} elseif ($response->isRedirect()) {
    // Redirect to offsite payment gateway
    $response->redirect();
} else {
    // Payment failed
    echo $response->getMessage();
}

You can find more information about Omnipay Qiwi, including usage examples, in the documentation.

Edit this code on GitHub