This repository has been archived by the owner on Dec 12, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Billplz/develop
Branch merge
- Loading branch information
Showing
144 changed files
with
2,443 additions
and
19,390 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/vendor/ |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,130 +1,48 @@ | ||
# Billplz API Class | ||
[![Latest Stable Version](https://poser.pugx.org/billplz/api)](https://packagist.org/packages/billplz/api) | ||
[![Total Downloads](https://poser.pugx.org/billplz/api/downloads)](https://packagist.org/packages/billplz/api) | ||
[![Latest Unstable Version](https://poser.pugx.org/billplz/api/v/unstable)](//packagist.org/packages/billplz/api) | ||
[![License](https://poser.pugx.org/billplz/api/license)](https://packagist.org/packages/billplz/api) | ||
|
||
- Billplz API v3 using Guzzle 6 <br> | ||
- Latest Version: **3.07** <br> | ||
- Last Update: **19 December 2017** | ||
## Minimum System Requirement | ||
- PHP 5.6 or newer | ||
|
||
# Minimum System Requirement | ||
- PHP 5.5 or newer | ||
- Linux or Windows-Based Hosting/Server | ||
## Installation | ||
|
||
# Installation | ||
To install through composer, simply execute: | ||
|
||
1. Clone this repository | ||
2. Import **billplz.php** file to your PHP file. | ||
3. Create object and use the provided method | ||
|
||
# Features | ||
|
||
- Automatically detect mode (Production/Staging) based on API Key | ||
- Automatically create Collection ID if not created | ||
- Automatically choose Collection ID if not set | ||
- Option to check and Collection ID validity | ||
- Option to send Email Notification only or SMS Notification only | ||
- Automatic fallback to no notification if Mobile Number is invalid or vice versa | ||
- X Signature (HMAC SHA256 Validation) for Redirect and Callback ready | ||
- Linux & Windows Server Compatible | ||
|
||
# API Access Ability | ||
|
||
- Create A Collection | ||
- Create A Bill | ||
- Get A Bill | ||
- Delete A Bill | ||
- Check Collection ID Availability | ||
- Get Collection Index | ||
|
||
# Example: 0. Import & Create Object | ||
|
||
``` | ||
require 'billplz.php'; | ||
$billplz = new Billplz('<api_key>'); | ||
``` | ||
|
||
# Example: 1. Create A Bill | ||
|
||
1. **Set Required Parameter** | ||
|
||
``` | ||
$billplz | ||
->setName('Wan Zulkarnain') | ||
->setAmount('10.60') | ||
->setEmail('youremail@gmail.com') | ||
->setDescription('Test Payment') | ||
->setPassbackURL('http://callback-url.com', 'http://redirect-url.com') | ||
->create_bill(true); | ||
``` | ||
|
||
2. **Set Optional Parameter** | ||
|
||
Optionally, before you call the **create_bill()** method, you can set optional parameter. | ||
|
||
``` | ||
$billplz | ||
->setCollection('<collection_id>') | ||
->setReference_1('ID') | ||
->setReference_1_Label('A') | ||
->setReference_2('Lot 100, AAA, BB') | ||
->setReference_2_Label('Address') | ||
->setMobile('0145356443') | ||
->setDeliver('3') | ||
->create_bill(true); | ||
``` | ||
|
||
3. **Get Bill ID & URL** | ||
|
||
``` | ||
$bill_id = $billplz->getID(); | ||
$billl_url = $billplz->getURL(); | ||
```bash | ||
composer require billplz/api guzzlehttp/guzzle | ||
``` | ||
|
||
# Example: 2. Get A Bill | ||
or | ||
|
||
```json | ||
{ | ||
"require": { | ||
"billplz/api": "^3.7", | ||
"guzzlehttp/guzzle": "~6.0" | ||
} | ||
} | ||
``` | ||
$billplz->check_bill('<bill_id>'); | ||
``` | ||
This method will return a string of array. Refer: https://billplz.com/api#v3-get-a-bill25 | ||
|
||
# Example: 3. Delete A Bill | ||
|
||
``` | ||
$billplz->deleteBill('<bill_id>'); | ||
``` | ||
This method will return boolean value. **true** if succesfully deleted or **false** if the bills cannot be deleted. | ||
## Usages | ||
|
||
# Example: 4. Create A Collection | ||
### Connecting with Billplz API | ||
|
||
``` | ||
$billplz->create_collection('Payment for Purchase'); | ||
``` | ||
By it's design, the Connect class are able to determine the API Key is belong to Production or Staging environment. | ||
|
||
# Example: 5. Check Collection ID Availability | ||
```php | ||
<?php | ||
|
||
``` | ||
$billplz->check_collection_id('<collection_id>'); | ||
``` | ||
This method will return boolean value. **true** if already created **false** if not created yet/invalid. | ||
|
||
# Example: 6. Get Collection Index | ||
|
||
Collection will be divided to several page. For getting the first page of collection, pass '1' as passing parameter. | ||
|
||
``` | ||
$billplz->getCollectionIndex('1'); | ||
``` | ||
|
||
# Example: 7. Get Redirect & Callback Data | ||
|
||
To use this method, you must ensure that X Signature Key is enabled for your account. No Billplz Object is required because this is a static method. | ||
|
||
``` | ||
// Redirect | ||
Billplz::getRedirectData('<x_signature_key>'); | ||
use Billplz\Connect; | ||
$connnect = (new Connect('4e49de80-1670-4606-84f8-2f1d33a38670'))->detectMode(); | ||
|
||
// Callback | ||
Billplz::getCallbackData('<x_signature_key>'); | ||
// Or manually set the mode | ||
$connnect = new Connect('4e49de80-1670-4606-84f8-2f1d33a38670'); | ||
$connect->setMode(true); | ||
``` | ||
|
||
# Other | ||
## Other | ||
|
||
Please open an issue or email to wan@billplz.com |
Oops, something went wrong.