neonexxa / billplz-wrapper
php billplz 包装器
v2.0
2019-09-05 11:10 UTC
Requires
- php: >=5.3.0
README
wrapper v3.0 will be updated next month with the mastercard/visa
PHP 支付网关
这是一个用于操作 Billplz v3 的 PHP 库。请确保您已注册并从那里获取您的 API 令牌。我创建这个库是因为我使用的所有 API 都与 v2 兼容,我担心它不与 v3 兼容。我只是担心,所以我在我的其他项目中构建了一个用于个人使用的包。
安装
Composer
composer require neonexxa/billplz-wrapper
Github
只需下载任何版本或克隆此存储库。请随意使用您想要的方式。
对于 Laravel
1) 在您的 config/app.php 中,将以下内容添加到您的服务提供器类中
Neonexxa\BillplzWrapperV3\BillplzServiceProvider::class,
2) 在 .env 文件中放入您的密钥
BILLPLZ_API_KEY=xxxxx-xxxx-xxxx-xxxx-xxxx
3) 运行
composer dump-autoload && php artisan config:cache && php artisan cache:clear php artisan vendor:publish --provider="Neonexxa\BillplzWrapperV3\BillplzServiceProvider"
以准备您的配置设置。
如何使用(创建)
创建集合
必需参数
- 标题
use Neonexxa\BillplzWrapperV3\BillplzCollection; $res = new BillplzCollection; $res->title = "New Collection"; // and other optional params $res = $res->create_collection(); list($rheader, $rbody, $rurl) = explode("\n\r\n", $res); $bplz_result = json_decode($rurl);
获取集合
必需参数
- collection_id
use Neonexxa\BillplzWrapperV3\BillplzCollection; $res1 = new BillplzCollection; $res1->collection_id = "xxxxxx"; $res1 = $res1->get_collection(); list($rheader, $rbody, $rurl) = explode("\n\r\n", $res1); $bplz_result = json_decode($rurl);
获取集合索引
use Neonexxa\BillplzWrapperV3\BillplzCollection; $res2 = new BillplzCollection; $res2 = $res2->get_collection(); list($rheader, $rbody, $rurl) = explode("\n\r\n", $res2); $bplz_result = json_decode($rurl);
激活集合
必需参数
- collection_id
use Neonexxa\BillplzWrapperV3\BillplzCollection; $res5 = new BillplzCollection; $res5->collection_id = "xxxxxx"; $res5 = $res5->activate_collection();
停用集合
必需参数
- collection_id
- activate=false
use Neonexxa\BillplzWrapperV3\BillplzCollection; $res4 = new BillplzCollection; $res4->collection_id = "xxxxxx"; $res4->activate = false ; $res4 = $res4->activate_collection(); list($rheader, $rbody, $rurl) = explode("\n\r\n", $res4); $bplz_result = json_decode($rurl);
创建开放集合
必需参数
- 标题
- 描述
- 金额(如果 fixed_amount=false,则将被忽略)
$res = new BillplzOpenCollection; $res->title = "New Open collection"; $res->description = "New Open collection desc"; // $res->fixed_amount = false; $res->amount = 2*100; $res = $res->create_opencollection(); list($rheader, $rbody, $rurl) = explode("\n\r\n", $res); $bplz_result = json_decode($rurl);
获取开放集合
必需参数
- collection_id
$res2 = new BillplzOpenCollection; $res2->collection_id = $bplz_result->id; $res2 = $res2->get_opencollection();
获取开放集合索引
$res3 = new BillplzOpenCollection; $res3 = $res3->get_opencollection();
创建账单
必需参数
- collection_id
- 描述
- 电子邮件
- 姓名
- 金额
- 回调 URL
$res0 = new BillplzBill; $res0->collection_id = "xxxxxx"; // which collection you want to park this bill under $res0->description = "New BIll"; // bill description $res0->email = "Receipientofthebill@receipientcompany.com"; // client email $res0->name = "receipientname"; // cleint name $res0->amount = 2*100; // by default in cent $res0->callback_url = "yourwebsite@example.com"; // callback url after execution // and other optional params $res0 = $res0->create_bill(); list($rhead ,$rbody, $rurl) = explode("\n\r\n", $res0); $bplz_result = json_decode($rurl);
获取账单
必需参数
- bill_id
$res = new BillplzBill; $res->bill_id = $bplz_result->id; $res = $res->get_bill(); list($rhead ,$rbody, $rurl) = explode("\n\r\n", $res); $bplz_result = json_decode($rurl);
删除账单
必需参数
- bill_id
$res2 = new BillplzBill; $res2->bill_id = $bplz_result->id; $res2 = $res2->delete_bill();
目前就是这样,暂时还没有其他内容...