iyamk / perfectmoney-api
v1.0.1
2023-06-11 07:20 UTC
Requires
- php: >=7.2.5
- guzzlehttp/guzzle: ^7.0
- paquettg/php-html-parser: ^3.1
This package is auto-updated.
Last update: 2024-09-11 10:10:27 UTC
README
Perfect money 完整库
此库适用于任何项目,旨在简单易用。
安装
composer require iyamk/perfectmoney-api
用法
首先,您需要一个配置文件。在方便的位置创建一个 config_pm.php 文件
<?php
# If not loaded before
require_once __DIR__ . '/vendor/autoload.php';
# Instance creation
$pm = new \PM\Api('your wallet number', 'alternate passphrase', 'https://example.com/status_url', 'https://example.com/done_url', 'https://example.com/fail_url', 'My corp.', 'your account id', 'account password');
现在,在显示支付表单的地方,添加以下内容
require_once __DIR__.'/config_pm.php';
echo $pm->getForm('your order id', '1.23', 'description payment');
这将显示一个表单,点击“支付”进行支付
然后,将以下代码添加到支付状态处理器的位置
require_once __DIR__.'/config_pm.php';
$r = $pm->checkPay();
if ($r['status'])
{
// The request has been validated and can be trusted, now populate the value into the database and make the necessary checks
print_r($r);
}
else
{
// An error has occurred, you can write it to the log
echo $r['error'];
}
享受吧!
请求余额
$r = $pm->getBalance();
print_r($r);
文档
这里: https://iyamk.github.io/perfectmoney-api/doc
贡献
通过拉取请求与我们一起贡献