1. Go to this page and download the library: Download izzudin96/billplz-laravel 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/ */
use Izzudin96\Billplz\BillplzClient;
public function show(string $billId, BillplzClient $billplz)
{
$bill = $billplz->getBill($billId);
}
use Izzudin96\Billplz\BillplzClient;
class PaymentController extends Controller
{
public function __construct(private BillplzClient $billplz)
{
}
public function show(string $billId)
{
$bill = $this->billplz->getBill($billId);
}
}
use Izzudin96\Billplz\Facades\Billplz;
$bill = Billplz::getBill($billId);
use Izzudin96\Billplz\BillplzClient;
$bill = app(BillplzClient::class)->getBill($billId);
use Izzudin96\Billplz\BillplzClient;
$bill = app(BillplzClient::class)->createBill(
email: '[email protected]',
mobile: '60123456789',
name: 'User Name',
amountCents: 25900, // RM259.00 in cents/sen
callbackUrl: route('payments.billplz.webhook'),
description: 'Booking BK-10021',
optional: [
'redirect_url' => route('payments.billplz.callback'),
'reference_1_label' => 'Booking Ref',
'reference_1' => 'BK-10021',
'reference_2_label' => 'Customer ID',
'reference_2' => 'CUS-890',
// Additional Billplz-supported fields can be passed through here.
// Required fields from method params always take precedence.
],
);
// Save for reconciliation and redirect user to Billplz page
$billId = $bill->id;
$paymentUrl = $bill->url;
use Izzudin96\Billplz\BillplzClient;
$bill = app(BillplzClient::class)->getBill($billId);
// Examples of useful fields from Billplz response:
// $bill->paid
// $bill->paid_at
// $bill->state