PHP code example of rick20 / ppob

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

    

rick20 / ppob example snippets


...
'accounts' => [
    'account-A' => [
        'provider' => 'mobile-pulsa',
        'username' => 'usernameA',
        'apikey' => 'apikeyA'
    ],
    'account-B' => [
        'provider' => 'mobile-pulsa',
        'username' => 'usernameB',
        'apikey' => 'apikeyB'
    ],
]
...


use Rick20\PPOB\Products\Pulsa;
use Rick20\PPOB\Products\TokenPLN;
use Rick20\PPOB\Products\GenericProduct;

// Topup Pulsa
$status = PPOB::topup(new Pulsa('082112345678', 50000), 'ref123');

// Check your deposit balance 
$balance = PPOB::balance();

// Check status of a transaction
$status = PPOB::status('ref123');

// Use another account
$status = PPOB::account('account-portalpulsa')->topup(
  new TokenPLN('no-meter', 'no-hp', 100000), 'ref456'
);

// Purchase other products
$status = PPOB::account('account-tripay')->topup(
  new GenericProduct('subscriber-id', 'no-hp', 'product-code'), 'ref789'
);