leonardjke / omnipay-qiwi

MIT License
0 stars 1 forks source link

Omnipay: omnipay-qiwi

Qiwi P2P gateway for the Omnipay PHP payment processing library

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

Omnipay is a framework agnostic, multi-gateway payment processing library for PHP 5.3+. This package implements omnipay-qiwi support for Omnipay.

This is where your description should go. Try and limit it to a paragraph or two, and maybe throw in a mention of what PSRs you support to avoid any confusion with users and contributors.

Install

Instal the gateway using require. Require the league/omnipay base package and this gateway.

$ composer require league/omnipay leonardjke/omnipay-qiwi

Usage

How to initialize Qiwi P2P

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

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

To add some custom configs use. Example, https://developer.qiwi.com/en/p2p-payments/#custom

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

To set return page use

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

Or everything in initialize step

/** @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'],
]);

How to accept webhook from qiwi

/** @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();

Support

If you are having general issues with Omnipay, we suggest posting on Stack Overflow. Be sure to add the omnipay tag so it can be easily found.

If you want to keep up to date with release announcements, discuss ideas for the project, or ask more detailed questions, there is also a mailing list which you can subscribe to.

If you believe you have found a bug, please report it using the GitHub issue tracker, or better yet, fork the library and submit a pull request.

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email :author_email instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.