dpsoft / pay.ir
Pay.ir 在线支付 - 简单易用的PHP语言支付网关
v1.0
2020-07-07 12:54 UTC
Requires
- php: ^7.1
- ext-json: *
- rmccue/requests: >=1.0
Requires (Dev)
- phpunit/phpunit: ^7.0
This package is auto-updated.
Last update: 2024-08-28 07:27:16 UTC
README
安装
您可以通过composer安装此包
composer require dpsoft/pay.ir
使用
将 sample
目录复制到服务器上。在浏览器中打开 request.php
并进行操作...
请求
try { $pay = new \Dpsoft\Pay\Pay($apiKey); $result = $pay->request($callbackUrl,$amount); //save amount and invoice id to forther use $_SESSION['amount']=$amount; $_SESSION['invoice_id']=$result['invoice_id']; $pay->redirectToBank(); exit(); }catch (Throwable $exception){ echo $exception->getMessage(); }
响应
try { $pay = new \Dpsoft\Pay\Pay(); $result = $pay->verify($_SESSION['amount'],$_SESSION['invoice_id']); //save result. The keys are: card_number,transaction_id and token for example $result['token'] echo "Successfull transaction."; }catch (Throwable $exception){ echo "Error in transaction: "; }
测试
composer test
安全
如果您发现任何与安全相关的问题,请通过电子邮件 info@dpsoft.ir 联系我们,而不是使用问题跟踪器。
致谢
许可证
MIT许可证(MIT)。有关更多信息,请参阅许可证文件。