ENLISH | 中文
NAV Navbar
php

Introduction

API Endpoint:

			
https://{Request from us}/merchant
			
		

Welcome to the Fpay API! You can use our API to access Fpay 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 Fpay 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
  1. Customer visits your site.
  2. Customer choose product/fee and make payment .
  3. Your site create a order with id fee product info.
  4. Curl auth api to get a new auth token .
  5. Curl generate_orders api with order params , Fpay will return url as response.
  6. Your site redirects the customer to the Fpay url.
  7. The Customer makes payment via payment option of choice.
  8. Fpay sends a server-side update to your site upon payment failure or success refer to your callback url.

Api Currency

Example Request:

			
<?php
$username = "fpay-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 Fpay accept.

Api Auth

Example Request:

			
<?php
$username = "fpay-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 Fpay 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"; //Merchant 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 params for apply prepaird card only . option : DIGI , MAXIS , CELCOM

$send = array(
	  'username' => $username, 
	  'auth' => $auth, 
	  'amount' => $amount, 
	  'currency' => $currency, 
	  'orderid' => $orderid,
	  'email' => $email, 
	  'phone_number' => $phone_number,
	  'mode' => $mode
	);
	
$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 . Fpay 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 = "fpay_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 = "fpay_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 Fpay 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 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 Fpay check_withdraw_status api by providing username and id in request.

Introduction

API Endpoint:

			
https://{Request from us}/merchant
			
		

Welcome to the Fpay API! You can use our API to access Fpay 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 Fpay 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
  1. Customer visits your site.
  2. Customer choose product/fee and make payment .
  3. Your site create a order with id fee product info.
  4. Curl auth api to get a new auth token .
  5. Curl generate_orders api with order params , Fpay will return url as response.
  6. Your site redirects the customer to the Fpay url.
  7. The Customer makes payment via payment option of choice.
  8. Fpay sends a server-side update to your site upon payment failure or success refer to your callback url.

Api Currency

Example Request:

			
<?php
$username = "fpay-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 Fpay accept.

Api Auth

Example Request:

			
<?php
$username = "fpay-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 Fpay 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"; //Merchant 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

$send = array(
	  'username' => $username, 
	  'auth' => $auth, 
	  'amount' => $amount, 
	  'currency' => $currency, 
	  'orderid' => $orderid,
	  'email' => $email, 
	  'phone_number' => $phone_number 
	);
	
$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": "VND",
    "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": "VND",
    "order_status":"fail",
    "status": true,
    "token":"aZ3423432CWWSDFssdf",
    "charge":"5.00",
    "type":"deposit",
}    
			
		

Example Response(Withdraw) - completed:

			
{
    "order_id": "Testpayout008",
    "amount": 1,
    "currency": "VND",
    "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": "VND",
    "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 . Fpay 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 = "fpay_test"; //Get from auth api
$amount = 100; //Price amount
$currency = "VND"; //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 = "fpay_test"; //Merchant username
$currency = "VND"; //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": "VND",
            "bank_name": "Techcom Bank",
            "id": "1"
        },
        {
            "currency": "VND",
            "bank_name": "Techcom Bank",
            "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": "VND",
}
			
		

Example Response - Fail:

			
{
    "status": true,
    "order_status": "fail",
    "order_datetime": "2021-11-19 13:30:00",
    "amount": 25.0000,
    "currency": "VND",
}
			
		

Example Response - Pending:

			
{
    "status": true,
    "order_status": "pending",
    "order_datetime": "2021-11-20 20:00:00",
    "amount": 100.0000,
    "currency": "VND",
}
			
		

Your order status for Fpay 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 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": "VND",
}
			
		

Example Response - Fail:

			
{
    "status": true,
    "order_status": "fail",
    "order_datetime": "2021-11-19 13:30:00",
    "amount": 25.0000,
    "currency": "VND",
}
			
		

Example Response - Pending:

			
{
    "status": true,
    "order_status": "pending",
    "order_datetime": "2021-11-20 20:00:00",
    "amount": 100.0000,
    "currency": "VND",
}
			
		

Your withdraw status for Fpay check_withdraw_status api by providing username and id in request.

Introduction

API Endpoint:

			
https://{Request from us}/merchant
			
		

Welcome to the Fpay API! You can use our API to access Fpay 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 Fpay 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
  1. Customer visits your site.
  2. Customer choose product/fee and make payment .
  3. Your site create a order with id fee product info.
  4. Curl auth api to get a new auth token .
  5. Curl bank_list api to get bank id .
  6. Curl generate_orders api with order params , Fpay will return url as response.
  7. Your site redirects the customer to the Fpay url.
  8. The Customer makes payment via payment option of choice.
  9. Fpay sends a server-side update to your site upon payment failure or success refer to your callback url.

Api Currency

Example Request:

			
<?php
$username = "fpay-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 Fpay accept.

Api Auth

Example Request:

			
<?php
$username = "fpay-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 Fpay generate_orders api by providing your Api_key and username in request.

You can get Api_keys from your account settings page.

Bank List

Example Request:

			
<?php
$username = "fpay_test"; //Merchant username

$send = array(
	  'username' => $username
	);
	
$apiurl = "https://{Request from us}/wallet/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": "THB",
            "bank_name": "SCB",
            "id": "1"
        },
        {
            "currency": "THB",
            "bank_name": "bangkok bank",
            "id": "2"
        }
    ]
}
			
		

Curl Bank List api to get Bank details for generate orders.

Api Generate orders

Example Request:

			
<?php
$username = "john"; //Merchant 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
$bank_id = "1"; //Bank id get from api bank_list

$send = array(
	  'username' => $username, 
	  'auth' => $auth, 
	  'amount' => $amount, 
	  'currency' => $currency, 
	  'orderid' => $orderid,
	  'email' => $email, 
	  'phone_number' => $phone_number,
	  'bank_id' => $bank_id
	);
	
$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": "THB",
    "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": "THB",
    "order_status":"fail",
    "status": true,
    "token":"aZ3423432CWWSDFssdf",
    "charge":"5.00",
    "type":"deposit",
}    
			
		

Example Response(Withdraw) - completed:

			
{
    "order_id": "Testpayout008",
    "amount": 1,
    "currency": "THB",
    "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": "THB",
    "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 . Fpay 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 = "fpay_test"; //Get from auth api
$amount = 100; //Price amount
$currency = "THB"; //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 = "fpay_test"; //Merchant username
$currency = "THB"; //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": "THB",
            "bank_name": "Siam Commercial Bank",
            "id": "1"
        },
        {
            "currency": "THB",
            "bank_name": "Siam Commercial Bank",
            "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": "THB",
}
			
		

Example Response - Fail:

			
{
    "status": true,
    "order_status": "fail",
    "order_datetime": "2021-11-19 13:30:00",
    "amount": 25.0000,
    "currency": "THB",
}
			
		

Example Response - Pending:

			
{
    "status": true,
    "order_status": "pending",
    "order_datetime": "2021-11-20 20:00:00",
    "amount": 100.0000,
    "currency": "THB",
}
			
		

Your order status for Fpay 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 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": "THB",
}
			
		

Example Response - Fail:

			
{
    "status": true,
    "order_status": "fail",
    "order_datetime": "2021-11-19 13:30:00",
    "amount": 25.0000,
    "currency": "THB",
}
			
		

Example Response - Pending:

			
{
    "status": true,
    "order_status": "pending",
    "order_datetime": "2021-11-20 20:00:00",
    "amount": 100.0000,
    "currency": "THB",
}
			
		

Your withdraw status for Fpay check_withdraw_status api by providing username and id in request.

Introduction

API Endpoint:

			
https://{Request from us}/merchant
			
		

Welcome to the Fpay API! You can use our API to access Fpay 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 Fpay 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
  1. Customer visits your site.
  2. Customer choose product/fee and make payment .
  3. Your site create a order with id fee product info.
  4. Curl auth api to get a new auth token .
  5. Curl bank_list api to get bank id .
  6. Curl generate_orders api with order params , Fpay will return url as response.
  7. Your site redirects the customer to the Fpay url.
  8. The Customer makes payment via payment option of choice.
  9. Fpay sends a server-side update to your site upon payment failure or success refer to your callback url.

Api Currency

Example Request:

			
<?php
$username = "fpay-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 Fpay accept.

Api Auth

Example Request:

			
<?php
$username = "fpay-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 Fpay generate_orders api by providing your Api_key and username in request.

You can get Api_keys from your account settings page.

Bank List

Example Request:

			
<?php
$username = "fpay_test"; //Merchant username

$send = array(
	  'username' => $username
	);
	
$apiurl = "https://{Request from us}/wallet/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": "THB",
            "bank_name": "SCB",
            "id": "1"
        },
        {
            "currency": "THB",
            "bank_name": "bangkok bank",
            "id": "2"
        }
    ]
}
			
		

Curl Bank List api to get Bank details for generate orders.

Api Generate orders

Example Request:

			
<?php
$username = "john"; //Merchant 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
$bank_id = "1"; //Bank id get from api bank_list

$send = array(
	  'username' => $username, 
	  'auth' => $auth, 
	  'amount' => $amount, 
	  'currency' => $currency, 
	  'orderid' => $orderid,
	  'email' => $email, 
	  'phone_number' => $phone_number,
	  'bank_id' => $bank_id
	);
	
$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": "IDR",
    "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": "IDR",
    "order_status":"fail",
    "status": true,
    "token":"aZ3423432CWWSDFssdf",
    "charge":"5.00",
    "type":"deposit",
}    
			
		

Example Response(Withdraw) - completed:

			
{
    "order_id": "Testpayout008",
    "amount": 1,
    "currency": "IDR",
    "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": "IDR",
    "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 . Fpay 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 = "fpay_test"; //Get from auth api
$amount = 100; //Price amount
$currency = "IDR"; //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 = "fpay_test"; //Merchant username
$currency = "IDR"; //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": "IDR",
            "bank_name": "Bank Central of Asia",
            "id": "1"
        },
        {
            "currency": "IDR",
            "bank_name": "Bank Central of Asia",
            "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": "IDR",
}
			
		

Example Response - Fail:

			
{
    "status": true,
    "order_status": "fail",
    "order_datetime": "2021-11-19 13:30:00",
    "amount": 25.0000,
    "currency": "IDR",
}
			
		

Example Response - Pending:

			
{
    "status": true,
    "order_status": "pending",
    "order_datetime": "2021-11-20 20:00:00",
    "amount": 100.0000,
    "currency": "IDR",
}
			
		

Your order status for Fpay 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 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": "IDR",
}
			
		

Example Response - Fail:

			
{
    "status": true,
    "order_status": "fail",
    "order_datetime": "2021-11-19 13:30:00",
    "amount": 25.0000,
    "currency": "IDR",
}
			
		

Example Response - Pending:

			
{
    "status": true,
    "order_status": "pending",
    "order_datetime": "2021-11-20 20:00:00",
    "amount": 100.0000,
    "currency": "IDR",
}
			
		

Your withdraw status for Fpay check_withdraw_status api by providing username and id in request.