Download the PHP package nasrulhazim/billplz without Composer
On this page you can find all versions of the php package nasrulhazim/billplz. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nasrulhazim/billplz
More information about nasrulhazim/billplz
Files in nasrulhazim/billplz
Package billplz
Short Description PHP Agnostic library for working with BillPlz API
License MIT
Informations about the package billplz
PHP framework agnostic library for working with BillPlz API v3 and beyond...
- Installation
- Usages
- Creating Billplz Client
- Creating Collection Request
- Creating Bill Request
- Creating Check Request
- Creating Transaction Request
- Creating Bank Request
- Handling Response
- Checking the Response HTTP Status
- Checking the Response Header
Installation
To install through composer, simply put the following in your composer.json
file:
HTTP Adapter
Instead of utilizing php-http/guzzle6-adapter
you might want to use any other adapter that implements php-http/client-implementation
. Check Clients & Adapters for PHP-HTTP.
Usages
Creating Billplz Client
You can start by creating a Billplz client by using the following code (which uses php-http/guzzle6-adapter
):
You could also use php-http/discovery
to automatically pick available adapter installed via composer:
Using Sandbox
You can set to use development/sandbox environment by adding the following code:
Using different API Version
By default jomweb/billplz
would use v3
API version for any request, however you can customize this in future when new API version is available.
Creating Collection Request
Now you can create an instance of Collection:
You can also manually set the API version by doing
$billplz->collection('v3');
. You can also use$billplz->resource('Collection');
to get the same result.
Create a Collection
You can add a new collection by calling the following code:
You can also create new collection with optional parameters:
Create an Open Collection
Creating Bill Request
Now you can create an instance of Bill:
You can also manually set the API version by doing
$billplz->bill('v3');
. You can also use$billplz->resource('Bill');
to get the same result.
Create a Bill
You can add a new bill by calling the following code:
Payment Completion
You can setup a webhook to receive POST request from Billplz. In order to accept the response all you to do is write the following.
Get a Bill
Delete a Bill
Creating Transaction Request
Now you can create an instance of Transaction:
You can also manually set the API version by doing
$billplz->transaction('v3');
. You can also use$billplz->resource('Bill.Transaction');
to get the same result.
Get Transaction Index
You can get Transaction index by calling following code:
You also can provide optional parameters (page, status):
Creating Bank Request
Now you can create an instance of Bank:
You can also manually set the API version by doing
$billplz->bank('v3');
. You can also use$billplz->resource('Bank');
to get the same result.
Check Bank Account Registration Status
At any given time, you can request to check on a registration status by bank account number.
Get FPX Banks List
If you want to use Bank Direct Feature in Billplz, you need list of FPX Banks to send in create bill request.
You can get supported bank for FPX by calling following code:
Note: You will hit 401, Invalid access error if you have not enabled Bank Direct by Billplz. Contact Billplz for information.
Handling Response
Every request made to Billplz would return \Laravie\Codex\Response
which can fallback to \Psr\Http\Message\ResponseInterface
which would allow developer to further inspect the response.
Getting the Response
You can get the raw response using the following:
However we also create a method to parse the return JSON string to array.
Checking the Response HTTP Status
You can get the response status code via:
Checking the Response Header
You can also check the response header via the following code:
All versions of billplz with dependencies
laravie/codex Version ~1.0
php-http/multipart-stream-builder Version ^1.0
moneyphp/money Version ^3.0