cyvelnet/laravel-billplz
Composer 安装命令:
composer require cyvelnet/laravel-billplz
包简介
Flexible billing and payment solution from Billplz for laravel
README 文档
README
Laravel-billplz is a simple service providers and generator to connect your laravel powered app to Billplz api v3.
Before you getting started, kindly visit https://www.billplz.com/enterprise/signup to register an acount and read https://www.billplz.com/api#v3 for better understanding.
Install
Require this package with composer using the following command:
composer require cyvelnet/laravel-billplz
After updating and installed, add the service provider to the providers array in config/app.php file
Cyvelnet\LaravelBillplz\LaravelBillplzServiceProvider::class
And finally add the facade to the aliases array section in config/app.php
Cyvelnet\LaravelBillplz\Facades\Billplz::class
How to use
Bills api
Create a bill
To create a billplz bill
\Billplz::issue(function (Cyvelnet\LaravelBillplz\Messages\BillMessage $bill) { // bill with a amount RM50 $bill->to('name', 'email', 'mobile') ->amount(50) // will multiply with 100 automatically, so a RM500 bill, you just pass 500 instead of 50000 ->callbackUrl('http://foorbar.com/foo/bar/webhook/') ->description('description'); });
An UnacceptableRequestException will be throw for any call with any missing parameter.
Alternatively, you may generate reusable bill with artisan command php artisan make:bill MonthlyManagementBill
\Billplz::send(new MonthlyManagementBill()) ->to('foobar') ->viaEmail('foo@bar.com') // you may use viaSms('mobile no') or viaEmailAndSms('email', 'mobile no')
To delete an existing bill
$request = \Billplz::delete('bill_id'); if($request->isSuccess()) { // perform after deletion operation }
To retrieves a bill
$bill = \Billplz::get('bill_id')->toArray();
A BillNotFoundException will be throw for any missing bill.
Collections api
To create a collection
$request = \Billplz::collection('collection title'); if($request->isSuccess()) { $collection = $request->toArray() // you can call getRawBillplzResponse(false) to get response in POPO }
to customize your collection more, pass in an anonymous function as the second parameter
$request = \Billplz::collection('collection title', function (\Cyvelnet\LaravelBillplz\Messages\CollectionMessage $collection) { // split a payment by RM50 $collection->logo(storage_path('/billplz/my-logo.jpg')) ->splitPaymentByFixed('foo@bar.com', 50) // will convert into 5000 cents automatically });
To create an open collection with fixed amount
// create a open collection with a fixed amount RM500 $request = \Billplz::openCollection('collection title', 'collection description', 500); if($request->isSuccess()) { $collection = $request->toArray() // you can call getRawBillplzResponse(false) to get response in POPO }
To create an open collection with any amount and any quantity pass a closure as third parameter
// create a open collection with a fixed amount RM500 $request = \Billplz::openCollection('collection title', 'collection description', function (\Cyvelnet\LaravelBillplz\Messages\OpenCollectionMessage $collection) { $collection->anyAmountAndQty(); // ->splitPaymentByVariable('foo@bar.com', 50); // split payment by 50% // ->tax(6) // 6% tax // ->photo(storage_path('/billplz/my-photo.jpg')) // ->reference1('your references') }); if($request->isSuccess()) { $collection = $request->toArray() // you can call getRawBillplzResponse(false) to get response in POPO }
Sandbox
Billplz api v3, enabled sandbox functionality where developers are allowed to isolates api request to a sandbox and trigger payment completion on demand.
By default sandbox is disabled, to enable sandbox mode add a BILLPLZ_ENABLE_SANDBOX = true entry to .env and ensure you have proper configured api_key and collection_id for both production and sandbox.
cyvelnet/laravel-billplz 适用场景与选型建议
cyvelnet/laravel-billplz 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 701 次下载、GitHub Stars 达 7, 最近一次更新时间为 2016 年 09 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「billplz」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 cyvelnet/laravel-billplz 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 cyvelnet/laravel-billplz 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 cyvelnet/laravel-billplz 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP Agnostic library for working with BillPlz API
PHP library for BillPlz API, Malaysia's online payment
Alfabank REST API integration
Integrate Billplz to your Symfony applications
Laravel package for multiple payment gateway integration (SenangPay, iPay88, PayPal, Billplz, Midtrans)
Laravel package for Accurate Online API integration.
统计信息
- 总下载量: 701
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-09-19