SkillAgentSearch skills...

Billplz

PHP framework agnostic library for working with BillPlz API v3 and beyond...

Install / Use

/learn @jomweb/Billplz
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

PHP framework agnostic library for working with BillPlz API v3 and beyond...

tests Latest Stable Version Total Downloads Latest Unstable Version License Coverage Status

Installation

Composer

To install through composer by using the following command:

composer require php-http/guzzle7-adapter jomweb/billplz:^4.1

HTTP Adapter

Instead of utilizing php-http/guzzle7-adapter you might want to use any other adapter that implements php-http/client-implementation. Check Clients & Adapters for PHP-HTTP.

PHAR

If Composer isn't available on your application, you can opt for use Billplz PHAR which can be downloaded from the most recent GitHub Release. This build uses guzzlehttp/guzzle under the hood for all request to Billplz API.

You should received billplz.phar file which you can include to your project.

<?php

require "billplz.phar";

$client = Billplz\Client::make('your-api-key', 'your-x-signature-key');

Getting Started

<a name="creating-billplz-client"></a>

Creating Client

You can start by creating a Billplz client by using the following code (which uses php-http/guzzle6-adapter and php-http/discovery to automatically pick available adapter installed via composer):

<?php

use Billplz\Client;

$billplz = Client::make('your-api-key');

You can also send X-Signature key by doing the following:

<?php

use Billplz\Client;

$billplz = Client::make('your-api-key', 'your-x-signature-key');

Alternatively, you could also manually configure Http\Client\Common\HttpMethodsClient directly:

<?php

use Billplz\Client;

$http = Laravie\Codex\Discovery::client();

$billplz = new Client($http, 'your-api-key', 'your-x-signature-key');

Using Sandbox

You can set to use development/sandbox environment by adding the following code:

$billplz->useSandbox();

<a name="using-different-api-version"></a>

API Version

By default jomweb/billplz would use v4 API version for any request, however you can customize this in future when new API version is available.

$billplz->useVersion('v3');

Usages

<a name="creating-collection-request"></a>

Collection

Now you can create an instance of Collection:

$collection = $billplz->collection();

You can also manually set the API version by doing $billplz->collection('v3');. You can also use $billplz->uses('Collection'); to get the same result.

Create a Collection

You can add a new collection by calling the following code:

$response = $collection->create('My First API Collection');

var_dump($response->toArray());
return [
    "id" => "inbmmepb",
    "title" => "My First API Collection",
    "logo" => [
        "thumb_url" => null,
        "avatar_url" => null,
    ],
    "split_payment" => [
        "email" => null,
        "fixed_cut" => null,
        "variable_cut" => null,
    ]
];

You can also create new collection with optional parameters:

$response = $collection->create('My First API Collection', [
    'logo' => '@/Users/Billplz/Documents/uploadPhoto.png',
    'split_payment' => [
        'email' => 'verified@account.com',
        'fixed_cut' => \Duit\MYR::given(100),
    ],
]);

var_dump($response->toArray());
return [
    "id" => "inbmmepb",
    "title" => "My First API Collection",
    "logo" => [
        "thumb_url" => "https://sample.net/assets/uploadPhoto.png",
        "avatar_url" => "https://sample.net/assets/uploadPhoto.png",
    ],
    "split_payment" => [
        "email" => "verified@account.com",
        "fixed_cut" => \Duit\MYR::given(100),
        "variable_cut" => null,
    ],
];

List of Collections

You can get Collection index by calling following code:

$response = $collection->all();

var_dump($response->toArray());
return [
    "collections": [{
        "id" => "inbmmepb",
        "title" => "My First API Collection",
        "logo" => [
            "thumb_url" => null,
            "avatar_url" => null,
        ],
        "split_header" => null,
        "split_payments" => [
            [
                "email" => "verified@account.com",
                "fixed_cut" => 100,
                "variable_cut" => 2,
                "stack_order" => 0,
            ],
            [
                "email" => "verified2@account.com",
                "fixed_cut" => 200,
                "variable_cut" => 3,
                "stack_order" => 1,
            ],
        ],
        "status" => "active",
    }],
    "page" => 1,
];

u also can provide optional parameters (page, status):

$response = $collection->all([
    'page' => 2,
    'status' => 'active',
]);

var_dump($response->toArray());
return [
    "collections": [{
        "id" => "inbmmepb",
        "title" => "My First API Collection",
        "logo" => [
            "thumb_url" => null,
            "avatar_url" => null,
        ],
        "split_header" => null,
        "split_payments" => [
            [
                "email" => "verified@account.com",
                "fixed_cut" => 100,
                "variable_cut" => 2,
                "stack_order" => 0,
            ],
            [
                "email" => "verified2@account.com",
                "fixed_cut" => 200,
                "variable_cut" => 3,
                "stack_order" => 1,
            ],
        ],
        "status" => "active",
    }],
    "page" => 2,
];

Get existing Collection

You can get existing collection by calling the following code:

$response = $collection->get('inbmmepb');

var_dump($response->toArray());
return [
    "id" => "inbmmepb",
    "title" => "My First API Collection",
    "logo" => [
        "thumb_url" => null,
        "avatar_url" => null,
    ],
    "split_header" => null,
    "split_payments" => [
        [
            "email" => "verified@account.com",
            "fixed_cut" => 100,
            "variable_cut" => 2,
            "stack_order" => 0,
        ],
        [
            "email" => "verified2@account.com",
            "fixed_cut" => 200,
            "variable_cut" => 3,
            "stack_order" => 1,
        ],
    ],
    "status" => "active",
];

Deactivate a collection

To use activate() and deactivate() function, you must explicitely use version v3. You can deactivate a collection by calling the following code:

$response = $collection->deactivate('inbmmepb');

Activate a collection

You can deactivate a collection by calling the following code:

$response = $collection->deactivate('inbmmepb');

Open Collection

Now you can create an instance of Collection:

$collection = $billplz->openCollection();

You can also manually set the API version by doing $billplz->openCollection('v3');. You can also use $billplz->uses('OpenCollection'); to get the same result.

Create an Open Collection

$response = $collection->create(
    'My First API Collection',
    'Maecenas eu placerat ante. Fusce ut neque justo, et aliquet enim. In hac habitasse platea dictumst.',
    \Duit\MYR::given(299)
);

var_dump($response->toArray());
return [
    "id
View on GitHub
GitHub Stars77
CategoryDevelopment
Updated25d ago
Forks31

Languages

PHP

Security Score

100/100

Audited on Mar 11, 2026

No findings