Skip to content
This repository has been archived by the owner on Dec 12, 2019. It is now read-only.

Commit

Permalink
Merge pull request #1 from Billplz/develop
Browse files Browse the repository at this point in the history
Branch merge
  • Loading branch information
wzul authored Feb 20, 2018
2 parents 7548a00 + 044e911 commit a6e1138
Show file tree
Hide file tree
Showing 144 changed files with 2,443 additions and 19,390 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/vendor/
65 changes: 0 additions & 65 deletions AllAction.php

This file was deleted.

30 changes: 0 additions & 30 deletions CreateABill.php

This file was deleted.

140 changes: 29 additions & 111 deletions README.md
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
Loading

0 comments on commit a6e1138

Please sign in to comment.