API Documentation

Configuration

HTTP Method POST
API URL https://pay.tokomini.net/api/v1
API Key (check here)
Response Format JSON

Mengambil Informasi Saldo

Parameter Value
access_key Your API Key
action balance
Contoh Response (JSON):
							
{
    "status": true,
    "action": "balance",
    "message": "IDR 3.809.488",
    "balance": "3809488"
}
						

PHP Example Scripts

How to Get Your Public IP to set as Remote IP on API Setting

<?php
$api_url = "https://pay.tokomini.net/api/v1";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$result = curl_exec($ch);
curl_close($ch);

$response = json_decode($result);
print_r($response);


/*
Run this script, and return data will be like it (ip_address is your remote ip):
stdClass Object ( [status] => [message] => Access Forbidden [ip_address] => 182.1.113.35 )
*/
?>
							

Get Account Balance

<?php
$api_key = ""; // Change with Your API Key
$api_url = "https://pay.tokomini.net/api/v1";
$param = array(
  'access_key'	=> $api_key,
  'action'	=> 'balance'
);

$_data = [];
foreach ($param as $name => $value)
{
  $_data[] = $name.'='.urlencode($value);
}

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, join('&', $_data));
$result = curl_exec($ch);
curl_close($ch);

$response = json_decode($result);
echo $response->balance;
?>								
							

Get List of All Product

<?php
$api_key = ""; // Change with Your API Key
$api_url = "https://pay.tokomini.net/api/pricelist";


$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$result = curl_exec($ch);
curl_close($ch);
$response = json_decode($result);

echo "<ul>";
foreach($response->data as $list)
{
	echo '
		<li>['.$list->product_code.'] '.$list->product_name.
		' have price '.$list->product_price.
		' is '.$list->product_status.'.</li>
	';
}
echo '</ul>';


/*
Example Result:
[A10] Axis 10rb have price 10810 is ready.
[A100] Axis 100rb have price 98225 is error.
[A15] Axis 15rb have price 14885 is ready.
dst..
 */

?>								
							

Add New Order

<?php
$api_key = ""; // Change with Your API Key
$api_url = "https://pay.tokomini.net/api/v1";
$param = array( 
  'access_key'	=> $api_key, 
  'action'	=> 'order',
  'trx_code'	=> 'S1', // Examples trx_code, you can change it
  'phone_number'=> '085222222222', // Examples destination phone number, you must change it
  'customer_id'	=> '0' // Examples trx_code is "0" because not needed, you can change it if order PLN Token, Topup Game or others.
);

$_data = [];
foreach ($param as $name => $value)
{
  $_data[] = $name.'='.urlencode($value);
}

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, join('&', $_data));
$result = curl_exec($ch);
curl_close($ch);

$response = json_decode($result);
if($response->status === TRUE)
{
	echo "New transaction added with id trasaction ".$response->idtrx;
}else
{
	echo "Order failed, error: ".$response->message;
}
?>