leonardjke/omnipay-qiwi

适用于 Omnipay 支付处理库的 Qiwi p2p 网关

1.0.0 2023-06-06 20:48 UTC

This package is auto-updated.

Last update: 2024-09-06 23:27:12 UTC


README

适用于 Omnipay PHP 支付处理库的 Qiwi P2P 网关

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

Omnipay 是一个不依赖于框架、多网关的 PHP 5.3+ 支付处理库。此包实现了 Omnipay 对 qiwi 的支持。

这里应该放置您的描述。尽量限制在一到两段话,并可能提及您支持的 PSRs 以避免与用户和贡献者产生混淆。

安装

使用 require 安装网关。需要 league/omnipay 基础包和此网关。

$ composer require league/omnipay leonardjke/omnipay-qiwi

使用

如何初始化 Qiwi P2P

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

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

要添加一些自定义配置,请使用。例如,https://developer.qiwi.com/en/p2p-payments/#custom

$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'],
]);

如何接受来自 Qiwi 的 webhook

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

支持

如果您遇到 Omnipay 的一般问题,我们建议在 Stack Overflow 上发布。请确保添加 omnipay 标签,以便更容易找到。

如果您想了解发布公告、讨论项目想法或提出更详细的问题,还有一个您可以订阅的 邮件列表

如果您认为您发现了一个错误,请使用 GitHub 问题跟踪器 报告,或者更好的方法是分支库并提交拉取请求。

变更日志

请参阅 CHANGELOG 了解最近更改的更多信息。

测试

$ composer test

贡献

请参阅 CONTRIBUTING 了解详细信息。

安全

如果您发现任何安全问题,请通过 :author_email 发送电子邮件,而不是使用问题跟踪器。

鸣谢

许可

MIT 许可证 (MIT)。有关更多信息,请参阅 许可文件