yiiviet / yii2-payment
扩展支持集成国内支付网关。
1.0.4
2019-01-31 07:23 UTC
Requires
- php: >=7.1.0
- vxm/yii2-gateway-clients: >=2.0.1
- yiisoft/yii2: >=2.0.13
This package is auto-updated.
Last update: 2024-09-23 07:42:09 UTC
README
Yii2 扩展,支持您集成国内支付网关。
目前国内支付网关的 API 结构非常多样化,且缺乏共性,这使得我们构建 api-client
时也遇到了很多困难。因此,这个扩展应运而生,旨在 同步各个支付网关的方法
,使得集成变得更加容易。它遵循 DRY 原则,帮助您在创建发送到支付网关的 request
时简化参数,因为所有支付网关都有共同的方法,这将使您在从一个支付网关切换到另一个支付网关时更加简单。
示例
$baoKim->purchase([ 'order_id' => 2, 'total_amount' => 500000, 'url_success' => '/' ]); $nganLuong->purchase([ 'bank_code' => 'VCB', 'buyer_fullname' => 'vxm', 'buyer_email' => 'admin@test.app', 'buyer_mobile' => '0909113911', 'total_amount' => 10000000, 'order_code' => microtime() ]); $onePay->purchase([ 'ReturnURL' => 'https:///', 'OrderInfo' => time(), 'Amount' => 500000, 'TicketNo' => '127.0.0.1', 'AgainLink' => 'https:///', 'Title' => 'Hello World', 'MerchTxnRef' => time() ]); $vnPayment->purchase([ 'TxnRef' => time(), 'OrderType' => 100000, 'OrderInfo' => time(), 'IpAddr' => '127.0.0.1', 'Amount' => 1000000, 'ReturnUrl' => 'https://' ]); $vtcPay->purchase([ 'amount' => 100000, 'reference_number' => time() ]); $momo->purchase([ 'amount' => 100000, 'orderId' => time(), 'requestId' => time(), 'returnUrl' => 'https://', 'notifyUrl' => 'https:///notify', ]);
支持的支付网关
要求
- PHP >= 7.1
- 对于宝库 Pro,需要 PHP 扩展:openSSL
- 对于宝库,需要 PHP 扩展:curl
- yiisoft/yii2 >= 2.0.13
- vxm/yii2-gateway-clients >= 2.0.1
安装
如果您对 composer
这个概念不熟悉,请点击 这里 了解它。
composer require "yiiviet/yii2-payment"
或者
"yiiviet/yii2-payment": "*"
在 composer.json 文件的 require
部分添加