PHP code example of kevinpurwito / laravel-rajabiller

1. Go to this page and download the library: Download kevinpurwito/laravel-rajabiller 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/ */

    

kevinpurwito / laravel-rajabiller example snippets


[
    'env' => strtolower(env('KP_RB_ENV', 'dev')), // dev or prod

    'url' => strtolower(env('KP_RB_URL', 'https://rajabiller.fastpay.co.id/transaksi/json_devel.php')),

    'uid' => env('KP_RB_UID'),

    'pin' => env('KP_RB_PIN'),
];

[
    Kevinpurwito\LaravelRajabiller\RajabillerServiceProvider::class,
];

[
    'Rajabiller' => Kevinpurwito\LaravelRajabiller\Facades\Rajabiller::class,
];

use Kevinpurwito\LaravelRajabiller\Facades\Rajabiller;

// returns the balance that you have
Rajabiller::getBalance();

// returns the list of orders you created in certain date (accepts date in Y-m-d format)
Rajabiller::orders('2021-01-20');

// returns the list of items under certain group (accepts string groupCode)
Rajabiller::groupItems('TELKOMSEL');

// returns the details of item (accepts string itemCode)
Rajabiller::item('S5H'); // telkomsel pulsa 5rb

// purchase an item, either pulsa or game voucher
Rajabiller::purchase('TXxxx', 'S5H', '628xxxx', 'pulsa'); // telkomsel pulsa 5rb

// inquiry for ppob (PLN, TELKOM, etc) price before paying
Rajabiller::inquiry('TXxxx', 'PLN', '123xxxx');

// pay for ppob (PLN, TELKOM, etc)
Rajabiller::pay('TXxxx', 'PLN', '123xxxx');


use Kevinpurwito\LaravelRajabiller\Facades\Rajabiller;

$response = Rajabiller::item('S5H'); // telkomsel pulsa 5rb

if ($response->getStatusCode() == 200) {
    // if you want to check the response body, such as `HARGA` you can do this:
    $content = json_decode($response->getBody()->getContents());
    dump($content);
//    {
//      "KODE_PRODUK": "S5H",
//      "UID": "UID",
//      "PIN": "PIN",
//      "STATUS": "00",
//      "KET": "SUKSES",
//      "HARGA": "5435",
//      "ADMIN": "",
//      "KOMISI": "0",
//      "PRODUK": "TELKOMSEL SIMPATI / AS 5RB",
//      "STATUS_PRODUK": "AKTIF",
//    }
}

text
KP_RB_ENV=dev
KP_RB_UID=user
KP_RB_PIN=secret
bash
php artisan vendor:publish --provider=Kevinpurwito\LaravelRajabiller\RajabillerServiceProvider --tag=rb-migrations
bash
php artisan db:seed --class=Kevinpurwito\LaravelRajabiller\Database\Seeders\RbSeeder
bash
php artisan rb-sync-items