1. Go to this page and download the library: Download nasrulhazim/billplz library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nasrulhazim / billplz example snippets
use Billplz\Client;
use Http\Client\Common\HttpMethodsClient;
use Http\Adapter\Guzzle6\Client as GuzzleHttpClient;
use Http\Message\MessageFactory\GuzzleMessageFactory;
$http = new HttpMethodsClient(
new GuzzleHttpClient(),
new GuzzleMessageFactory()
);
$billplz = new Client($http, 'your-api-key');
use Billplz\Client;
$billplz = Client::make('your-api-key');
$billplz->useSandbox();
$billplz->useVersion('v4');
$collection = $billplz->collection();
$response = $collection->create('My First API Collection');
var_dump($response->toArray());
$response = $collection->createOpen(
'My First API Collection',
'Maecenas eu placerat ante. Fusce ut neque justo, et aliquet enim. In hac habitasse platea dictumst.',
Money\Money::MYR(299)
);
var_dump($response->toArray());
return [
"id" => "0pp87t_6",
"title" => "MY FIRST API OPEN COLLECTION",
"description" => "Maecenas eu placerat ante. Fusce ut neque justo, et aliquet enim. In hac habitasse platea dictumst.",
"reference_1_label" => null,
"reference_2_label" => null,
"email_link" => null,
"amount" => \Money\Money::MYR(299),
"fixed_amount" => true,
"tax" => null,
"fixed_quantity" => true,
"payment_button" => "pay",
"photo" => [
"retina_url" => null,
"avatar_url" => null
],
"split_payment" => [
"email" => null,
"fixed_cut" => null,
"variable_cut" => null
],
"url" => "https://www.billplz.com/0pp87t_6"
]
$bill = $billplz->bill();
$response = $bill->create(
'inbmmepb',
'[email protected]',
null,
'Michael API V3',
Money\Money::MYR(200),
'http://example.com/webhook/',
'Maecenas eu placerat ante.'
);
var_dump($response->toArray());
if ($response->getStatusCode() !== 200) {
throw new SomethingHasGoneReallyBadException();
}
$response->getHeaders(); // get all headers as array.
$response->hasHeader('Content-Type'); // check if `Content-Type` header exist.
$response->getHeader('Content-Type'); // get `Content-Type` header.
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.