payboxmoney / pay
1.2.5
2018-12-21 08:56 UTC
Requires
- php: ^7.0
- payboxmoney/core: ^1.2.0
This package is auto-updated.
Last update: 2024-09-17 00:11:14 UTC
README
该包简化了与Paybox支付接收器交互的集成。
1) 安装包
为了安装包,请在控制台中输入以下命令
$ composer require payboxmoney/pay "^1.2"
2) 请求
通过PayBox直接初始化
示例 #1
<?php use Paybox\Pay\Facade as Paybox; $paybox = new Paybox(); $paybox->merchant->id = 123456; $paybox->merchant->secretKey = 'asflerjgsdfv'; $paybox->order->description = 'test order'; $paybox->order->amount = 100; if($paybox->init()) { header('Location:' . $paybox->redirectUrl); }
示例 #2
<?php use Paybox\Pay\Facade as Paybox; $paybox = new Paybox(); $paybox->getMerchant()->setId(123456); $paybox->getMerchant()->setSecretKey('asflerjgsdfv'); $paybox->getOrder()->setAmount(100); $paybox->getOrder()->setDescription('test order'); if($paybox->init()) { header('Location:' . $paybox->redirectUrl); }
示例 #3
<?php use Paybox\Pay\Facade as Paybox; $paybox = new Paybox(); $merchant = $paybox->getMerchant(); $merchant->setId(123456); $merchant->setSecretKey('asflerjgsdfv'); $order = $paybox->getOrder(); $order->setAmount(100); $order->setDescription('test order'); if($paybox->init()) { header('Location:' . $paybox->redirectUrl); }
银行卡交易清算请求
示例
<?php use Paybox\Pay\Facade as Paybox; $paybox = new Paybox(); $paybox->merchant->id = 123456; $paybox->merchant->secretKey = 'asflerjgsdfv'; //If You have a ID of payment and it status is success //You can initialize the clearing operation using capture() method $paybox->payment->id = 12345; $result = $paybox->capture();
获取支付状态请求
示例
<?php use Paybox\Pay\Facade as Paybox; $paybox = new Paybox(); //set required properties $paybox->getMerchant() ->setId(123456) ->setSecretKey('asflerjgsdfv'); // Не обязательно $paybox->getPayment() ->setId(11044111); $paybox->order->id = 2; $paymentStatus = $paybox->getStatus(); //partial/pending/ok/failed/revoked/incomplete
获取支付系统列表请求
示例
<?php use Paybox\Pay\Facade as Paybox; $paybox = new Paybox(); //set required properties $paybox->merchant->id = 123456; $paybox->merchant->secretKey = 'asflerjgsdfv'; $paybox->order->amount = 100; $paymentSystems = $paybox->getPaymentSystems();
支付前取消支付
示例
<?php use Paybox\Pay\Facade as Paybox; $paybox = new Paybox(); $paybox->merchant->id = 123456; $paybox->merchant->secretKey = 'asflerjgsdfv'; $request = (array_key_exists('pg_xml', $_REQUEST)) ? $paybox->parseXML($_REQUEST) : $_REQUEST; $result = $paybox->cancelBill();
支付后取消支付
示例
<?php use Paybox\Pay\Facade as Paybox; $paybox = new Paybox(); //set required properties $paybox->getMerchant() ->setId(123456) ->setSecretKey('asflerjgsdfv'); $paybox->getPayment() ->setId(11044111); //if you need to revoke a part of payment, You must use the "revoke" method with a argument $result = $paybox->revoke(100); //OR //if no artuments, whole the payment was be revoked $result = $paybox->revoke();
创建周期性支付
示例
<?php use Paybox\Pay\Facade as Paybox; $paybox = new Paybox(); $paybox->merchant->id = 123456; $paybox->merchant->secretKey = 'asflerjgsdfv'; $paybox->order->description = 'test order'; $paybox->order->amount = 100; $recurrentProfileLifetime = 12 //min = 1 month, max 156 monthes if($paybox->recurringStart($recurrentProfileLifetime)) { header('Location:' . $paybox->redirectUrl); }
重复周期性支付
示例
<?php use Paybox\Pay\Facade as Paybox; $paybox = new Paybox(); $paybox->merchant->id = 123456; $paybox->merchant->secretKey = 'asflerjgsdfv'; $paybox->order->description = 'test order'; $paybox->order->recurringProfile = 1234; $result = $paybox->makePayment();