Introduction
API Endpoint:
https://{Request from us}/merchant
Welcome to the Vpay88 API! You can use our API to access Vpay88 API endpoints to start sending bills and create order.
Our Api is send by FORM-DATA , JSON will be returned in all responses from API , including errors . The API will accept multipart/form-data.
Sandbox Mode
API Endpoint:
https://{Request from us}/merchant
The Vpay88 Sandbox mirrors the features found on the real production server , while some of the features do not apply to the Sandbox.
You should test your integrations and know they will behave the same on the production server as they do in Sandbox environment.
API Flow
NORMAL COMPLETION FLOW
- Customer visits your site.
- Customer choose product/fee and make payment .
- Your site create a order with id fee product info.
- Curl auth api to get a new auth token .
- Curl generate_orders api with order params , Vpay88 will return url as response.
- Your site redirects the customer to the Vpay88 url.
- The Customer makes payment via payment option of choice.
- Vpay88 sends a server-side update to your site upon payment failure or success refer to your callback url.
Api Currency
Example Request:
<?php
$username = "vpay88-test"; //Merchant username
$send = array('username' => $username );
$apiurl = "https://{Request from us}/merchant/currency";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 400);
curl_setopt($curl, CURLOPT_POSTFIELDS, $send);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: multipart/form-data"));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Example Response:
{
"status": true,
"rate": [
{
"currency": "MYR",
"min": 420.0000,
"max": 42000.0000
},
{
"currency": "SGD",
"min": 134.0000,
"max": 13400.0000
}
]
}
Use this api feature you will get currency list data and minimum , maximum amount that Vpay88 accept.
Api Auth
Example Request:
<?php
$username = "vpay88-test"; //Merchant username
$api_key = "EPSOWM0eewwrwer0OfUo"; //Api key get from panel settings page
$send = array('username' => $username , 'api_key' => $api_key);
$apiurl = "https://{Request from us}/merchant/auth";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 400);
curl_setopt($curl, CURLOPT_POSTFIELDS, $send);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: multipart/form-data"));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Example Response:
{
"status": true,
"auth": "t5IF5r2fXit1FnhjBVQv"
}
Example Response (Failed):
{
"status": false,
"message": "Params incorrect"
}
Your Auth token for Vpay88 generate_orders api by providing your Api_key and username in request.
You can get Api_keys from your account settings page.
Api Generate orders
Example Request:
<?php
$username = "john"; //Customer Username
$auth = "t5IF5r2fXit1FnhjBVQv"; //Get from auth api
$amount = 100; //Price amount
$currency = "MYR"; //Currency code
$orderid = "Example_123"; //Merchant order ID
$email = "[email protected]"; //Customer Email
$phone_number = "601012456789"; //Customer Phone number
$mode = "DIGI"; //Optional. Only available for certain merchant for apply prepaid card. Option : DIGI , MAXIS , CELCOM
$redirect_url = "https://www.google.com"; //Optional. For those who need redirect to different URL only.
$send = array(
'username' => $username,
'auth' => $auth,
'amount' => $amount,
'currency' => $currency,
'orderid' => $orderid,
'email' => $email,
'phone_number' => $phone_number,
'mode' => $mode,
'redirect_url' => $redirect_url
);
$apiurl = "https://{Request from us}/merchant/generate_orders";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 400);
curl_setopt($curl, CURLOPT_POSTFIELDS, $send);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: multipart/form-data"));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Example Response:
{
"status": true,
"p_url": "https://xxxxx.com/checkout/order-pay/92/?pay_for_order=true&key=1234"
}
Example Response (Failed):
//when email incorrect
{
"status": false,
"message": "email incorrect."
}
Example Response (Failed):
//when params missing
{
"status": false,
"message": "Params missing."
}
Example Response (Failed):
//when currency invalid
{
"status": false,
"message": "Currency invalid."
}
Example Response (Failed):
//When order id incorrect or exist
{
"status": false,
"message": "Order ID Exist."
}
Example Response (Failed):
//when amount empty or out of range
{
"status": false,
"message": "Invalid Amount."
}
Example Response (Failed):
//when auth expire or wrong
{
"status": false,
"message": "Params incorrect."
}
To generate a order , you would need to create a order on your side and get a Auth token #2 before generate.
After that you will send order info and auth token together as params to generate orders api , to get payment url.
Api Callback Url
Example Response (Generate Orders) - Completed:
{
"order_id": "20073",
"amount": 300.0000,
"currency": "MYR",
"order_status":"completed",
"status": true,
"charge": "9.0000",
"token":"cb2a91e02770eda1c42d7485f9048913",
"name":"john doe",
"type":"deposit",
}
Example Response(Generate Orders) - fail:
{
"order_id": "Example_123",
"amount": 25.0000,
"currency": "MYR",
"order_status":"fail",
"status": true,
"token":"aZ3423432CWWSDFssdf",
"charge":"5.00",
"type":"deposit",
}
Example Response(Withdraw) - completed:
{
"order_id": "Testpayout008",
"amount": 1,
"currency": "MYR",
"order_status":"completed",
"status": true,
"charge": "5.00",
"token":"5bf30f18349ce1211fdb0c7aff4d439b",
"name":"John Doe",
"type":"withdrawal",
"remarks":"Success",
}
Example Response(Withdraw) - fail:
{
"order_id": "Testpayout008",
"amount": 1,
"currency": "MYR",
"order_status":"fail",
"status": true,
"charge": "0",
"token":"7fd1297bfc1bd843e9627d09afce0893",
"name":"SUK THAWAR",
"type":"withdrawal",
"remarks":"Account Holder Name Mismatch (MR SUK THA != SUK THAWAR)",
}
After customer make payment . Vpay88 will make a POST request with JSON data to callback_url that set in your account settings page.
Note: Token will need check by MD5 "Secret_key" + "Order_id"
Api Withdraw orders
Example Request:
<?php
$auth = "vpay88_test"; //Get from auth api
$amount = 100; //Price amount
$currency = "MYR"; //Currency code
$orderid = "Example_123"; //Merchant withdraw order ID
$bank_id = "12"; //Get from withdraw bank list api
$bank_branch = "Kentucky"; //Optional
$holder_name = "John Doe"; //Insert the receiver holder name must same as receiver bank account.
$account_no = "12332343432"; //Receiver Bank Account no
$send = array(
'auth' => $auth,
'amount' => $amount,
'currency' => $currency,
'orderid' => $orderid,
'bank_id' => $bank_id,
'bank_branch' => $bank_branch,
'holder_name' => $holder_name,
'account_no' => $account_no,
);
$apiurl = "https://{Request from us}/merchant/withdraw_orders";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 400);
curl_setopt($curl, CURLOPT_POSTFIELDS, $send);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: multipart/form-data"));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Example Response(success):
{
"status": true,
"message": "Success",
}
Example Response(fail):
{
"status": false,
"message": "Params incorrect",
}
Example Response(fail):
{
"status": false,
"message": "Params missing.",
}
Example Response(fail):
{
"status": false,
"message": "bank_id invalid.",
}
Example Response(fail):
{
"status": false,
"message": "Balance not enough!",
}
Example Response(fail):
{
"status": false,
"message": "Amount Invalid!",
}
Example Response(fail):
{
"status": false,
"message": "Order id exist!",
}
To withdraw a order , you would need to create a withdraw order on your side and get a Auth token #2 before withdraw .
After that you will send withdraw order info and auth token together as params to withdraw orders api.
Withdraw Bank List
Example Request:
<?php
$username = "vpay88_test"; //Merchant username
$currency = "MYR"; //Optional
$send = array(
'username' => $username,
'currency' => $currency
);
$apiurl = "https://{Request from us}/wallet/withdraw_bank_list";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 400);
curl_setopt($curl, CURLOPT_POSTFIELDS, $send);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: multipart/form-data"));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Example Response:
{
"status": true,
"data": [
{
"currency": "MYR",
"bank_name": "Malayan Banking Berhad",
"id": "1"
},
{
"currency": "MYR",
"bank_name": "Malayan Banking Berhad",
"id": "2"
}
]
}
Curl withdraw bank list api to get bank details for withdraw orders .
API Check Status
Example Request:
<?php
$username = "john"; //Merchant Username
$id = "Example_123"; //Merchant order ID
$send = array(
'username' => $username,
'id' => $id
);
$apiurl = "https://{Request from us}/merchant/check_status";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 400);
curl_setopt($curl, CURLOPT_POSTFIELDS, $send);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: multipart/form-data"));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Example Response - Completed:
{
"status": true,
"order_status": "completed",
"order_datetime": "2021-11-18 15:00:00",
"amount": 300.0000,
"currency": "MYR",
}
Example Response - Fail:
{
"status": true,
"order_status": "fail",
"order_datetime": "2021-11-19 13:30:00",
"amount": 25.0000,
"currency": "MYR",
}
Example Response - Pending:
{
"status": true,
"order_status": "pending",
"order_datetime": "2021-11-20 20:00:00",
"amount": 100.0000,
"currency": "MYR",
}
Your order status for Vpay88 check_status api by providing username and id in request.
API Check Withdraw Status
Example Request:
<?php
$username = "john"; //Merchant Username
$id = "Example_123"; //Merchant Withdraw order ID
$send = array(
'username' => $username,
'id' => $id
);
$apiurl = "https://{Request from us}/merchant/check_withdraw_status";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 400);
curl_setopt($curl, CURLOPT_POSTFIELDS, $send);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: multipart/form-data"));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Example Response - Completed:
{
"status": true,
"order_status": "completed",
"order_datetime": "2021-11-18 15:00:00",
"amount": 300.0000,
"currency": "MYR",
}
Example Response - Fail:
{
"status": true,
"order_status": "fail",
"order_datetime": "2021-11-19 13:30:00",
"amount": 25.0000,
"currency": "MYR",
}
Example Response - Pending:
{
"status": true,
"order_status": "pending",
"order_datetime": "2021-11-20 20:00:00",
"amount": 100.0000,
"currency": "MYR",
}
Your withdraw status for Vpay88 check_withdraw_status api by providing username and id in request.