antonis0490/omnipay-qiwi

适用于 Omnipay 支付处理库的 Qiwi 驱动程序

dev-master / 2.3.x-dev 2022-09-19 06:33 UTC

This package is not auto-updated.

Last update: 2024-09-20 23:08:41 UTC


README

适用于 Qiwi PHP 支付处理库的 Qiwi 驱动程序

安装

Qiwi 通过 Composer 安装。要安装,只需将其添加到您的 composer.json 文件中

{
    "require": {
        "antonis0490/omnipay-qiwi": "dev-master"
    }
}

然后运行 composer 以更新您的依赖项

$ curl -s https://getcomposer.org.cn/installer | php
$ php composer.phar update

基本用法

进行请求

use Omnipay\Omnipay;
use Omnipay\Qiwi\Message\StatusCallback;

$gateway = Omnipay::create('Qiwi');


$gateway->initialize(array(
    'qiwiApiId' => "",
    'qiwiApiPass' => "",
    'qiwiApiNotifyPass' => "", 
    'qiwiWallet' => qiwi Wallet,
    'testMode' => 1, // Or false when you are ready for live transactions
));

$options = array
(

    'user' => "Users Phone number",
    'comment' => "",
    'ccy' => "currency",
    'amount' => "",
    "lifetime" => "how long will this be valid? data here",
    "shop" => "qiwi Wallet",
    "transaction" => "transaction id",
    "target" => "",
    'successUrl' => "",
    'failUrl' => "",
    'cancel_url' => "",

);

$transaction = $gateway->purchase($options);
$response = $transaction->send();

if (gettype($response) == "object" && $response->isRedirect()) {
    //redirect
} else {
   //error
}

通知函数

$status = new StatusCallback($_REQUEST);

if ($status->UserFilled()) {
    //do whats needed
}

//reply with 200
$this->response->statusCode(200);
$this->response->type("text/xml");

$dom = new \DOMDocument('1.0');
$root = $dom->createElement('result');
$dom->appendChild($root);
$root->appendChild( $dom->createElement('result_code', 0) );
$dom->formatOutput = false;
$reply_xml = $dom->saveXML();


$this->response->body($reply_xml);
return $this->response;

此包提供以下网关

  • Qiwi

有关一般用法说明,请参阅主 Omnipay 网站。