NAV
bash javascript php

Welcome to Moolahgo API v2.0

What's New

2 Nov 2019

Introduction

The API allows third party software/system to integrate into Moolahgo system to perform transaction and data updates. If you have many transactions frequently, it would be desirable to write a script to automate the process and create the transaction into our system.

Suggested Workflow

Below is the suggested workflow to create transaction in Moolahgo:

Request Sandbox

If you are interested in automating your workflow with our API, you can request for sandbox access by email to us at sales@moolahgo.com. Please include the following details in your email:

Alternatively, you can choose to connect with us through our website contact info.

Authentication

All authentication endpoints are access through https://identity.moolahgo.com/

Login

This endpoint login to Moolahgo system. ( https://identity.moolahgo.com/login )

Login using your username and password to obtain a transactional token. The token is to be used as bearer token in all other API request.

Example request:

curl -X POST "/login/username/password" 
const url = new URL("/login/username/password");

    let params = {
            "username": "joe",
            "password": "12345",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Accept": "application/json",
    "Content-Type": "application/json",
}

fetch(url, {
    method: "POST",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

$client = new \GuzzleHttp\Client();
$response = $client->post("//login/username/password", [
    'query' => [
            "username" => "joe",
            "password" => "12345",
        ],
]);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

{
    "success": true,
    "token": "tokenXXXX",
    "otprequired": 0
}

HTTP Request

POST /login/{username}/{password}

Query Parameters

Parameter Status Description
username required User name use to login.
password required Password use to login.

Login

This endpoint login to Moolahgo system. ( https://identity.moolahgo.com/login )

Login using your username and password to obtain a transactional token. The token is to be used as bearer token in all other API request.

Example request:

curl -X POST "/login" 
const url = new URL("/login");

    let params = {
            "username": "joe",
            "password": "12345",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Accept": "application/json",
    "Content-Type": "application/json",
}

fetch(url, {
    method: "POST",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

$client = new \GuzzleHttp\Client();
$response = $client->post("//login", [
    'query' => [
            "username" => "joe",
            "password" => "12345",
        ],
]);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

{
    "success": true,
    "token": "tokenXXXX",
    "otprequired": 0
}

HTTP Request

POST /login

Query Parameters

Parameter Status Description
username required User name use to login.
password required Password use to login.

Logout


Requires authentication This end point logout and invalidate the token.

Example request:

curl -X POST "/logout" \
    -H "Authorization: Bearer tokenXXXX"
const url = new URL("/logout");

let headers = {
    "Authorization": "Bearer tokenXXXX",
    "Accept": "application/json",
    "Content-Type": "application/json",
}

fetch(url, {
    method: "POST",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

$client = new \GuzzleHttp\Client();
$response = $client->post("//logout", [
    'headers' => [
            "Authorization" => "Bearer tokenXXXX",
        ],
]);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

{
    "success": true
}

HTTP Request

POST /logout

Market Data

All market data endpoints are access through https://rate.moolahgo.com/

Get exchange rate


Requires authentication This end point get the exchange rate to be used in the transaction.

Example request:

curl -X GET -G "/rate/SGD/IDR" \
    -H "Authorization: Bearer tokenXXXX"
const url = new URL("/rate/SGD/IDR");

    let params = {
            "sourcecurrency": "SGD",
            "destinationcurrency": "CNY",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer tokenXXXX",
    "Accept": "application/json",
    "Content-Type": "application/json",
}

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

$client = new \GuzzleHttp\Client();
$response = $client->get("//rate/SGD/IDR", [
    'headers' => [
            "Authorization" => "Bearer tokenXXXX",
        ],
    'query' => [
            "sourcecurrency" => "SGD",
            "destinationcurrency" => "CNY",
        ],
]);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

{
    "success": true,
    "rate": 5.0581766870575
}

HTTP Request

GET /rate/{source}/{destination}

Query Parameters

Parameter Status Description
sourcecurrency required Source currency code.
destinationcurrency required Destination currency code.

Recipient Management

All recipient management endpoints are access through https://transact.moolahgo.com/

Get a Recipient or all recipients


Requires authentication This endpoint get recipient(s) of current user. ( https://transact.moolahgo.com/recipient )

Example request:

curl -X GET -G "/recipient/1" \
    -H "Authorization: Bearer tokenXXXX"
const url = new URL("/recipient/1");

    let params = {
            "id": "123",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer tokenXXXX",
    "Accept": "application/json",
    "Content-Type": "application/json",
}

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

$client = new \GuzzleHttp\Client();
$response = $client->get("//recipient/1", [
    'headers' => [
            "Authorization" => "Bearer tokenXXXX",
        ],
    'query' => [
            "id" => "123",
        ],
]);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

{
    "success": true,
    "recipients": [
        {
            "id": 1,
            "userid": 1,
            "country": "Singapore",
            "city": "Singapore",
            "name": "Moolah Go",
            "bank": "DBS",
            "branch": "Central",
            "accountno": "0012345678",
            "email": "joe@moolahgo.com",
            "contact": "12345678",
            "contactcountrycode": "65",
            "createtime": "2018-01-25 18:00:01",
            "lastupdated": "2018-01-25 18:00:01",
            "lastused": null,
            "status": "active",
            "swift": null
        }
    ]
}

HTTP Request

GET /recipient/{id}

Query Parameters

Parameter Status Description
id required The recipient id or 'all' to get all recipient (limit at 50).

Create a new recipient


Requires authentication This end point create a new recipient and return the recipient id. ( https://transact.moolahgo.com/recipient )

Example request:

curl -X POST "/recipient" \
    -H "Authorization: Bearer tokenXXXX" \
    -H "Content-Type: application/json" \
    -d '{"acctname":"John","acctlastname":"Doe","acctno":"123456789","bankname":"Bank Central Asia","branch":"Jakarta Pusat","bankcity":"Jakarta","country":"Indonesia","swift":"CENAIDJAXXX","recemail":"john.doe@example.com","phonenumber":"123456789","address":"100 Street 1"}'
const url = new URL("/recipient");

let headers = {
    "Authorization": "Bearer tokenXXXX",
    "Content-Type": "application/json",
    "Accept": "application/json",
}

let body = {
    "acctname": "John",
    "acctlastname": "Doe",
    "acctno": "123456789",
    "bankname": "Bank Central Asia",
    "branch": "Jakarta Pusat",
    "bankcity": "Jakarta",
    "country": "Indonesia",
    "swift": "CENAIDJAXXX",
    "recemail": "john.doe@example.com",
    "phonenumber": "123456789",
    "address": "100 Street 1"
}

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

$client = new \GuzzleHttp\Client();
$response = $client->post("//recipient", [
    'headers' => [
            "Authorization" => "Bearer tokenXXXX",
            "Content-Type" => "application/json",
        ],
    'json' => [
            "acctname" => "John",
            "acctlastname" => "Doe",
            "acctno" => "123456789",
            "bankname" => "Bank Central Asia",
            "branch" => "Jakarta Pusat",
            "bankcity" => "Jakarta",
            "country" => "Indonesia",
            "swift" => "CENAIDJAXXX",
            "recemail" => "john.doe@example.com",
            "phonenumber" => "123456789",
            "address" => "100 Street 1",
        ],
]);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

{
    "success": true,
    "recipientid": "86"
}

HTTP Request

POST /recipient

Body Parameters

Parameter Type Status Description
acctname String required Account holder first name.
acctlastname String optional Last name of recipient.
acctno String required Account number of recipient.
bankname String required Name of recipient bank.
branch String required Branch of the bank.
bankcity String optional City of the bank.
country String required Destination country of transaction.
swift String optional Bank swift code.
recemail String optional Email of recipient.
phonenumber String optional Phone number of recipient.
address String optional Address of recipient.

Update a Recipient


Requires authentication This endpoint update a recipient. ( https://transact.moolahgo.com/recipient )

Example request:

curl -X PUT "/recipient/1" \
    -H "Authorization: Bearer tokenXXXX" \
    -H "Content-Type: application/json" \
    -d '{"acctname":"John","acctlastname":"Doe","acctno":"123456789","bankname":"Bank Central Asia","branch":"Jakarta Pusat","bankcity":"Jakarta","country":"Indonesia","swift":"CENAIDJAXXX","recemail":"john.doe@example.com","phonenumber":"123456789","address":"100 Street 1"}'
const url = new URL("/recipient/1");

    let params = {
            "id": "123",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer tokenXXXX",
    "Content-Type": "application/json",
    "Accept": "application/json",
}

let body = {
    "acctname": "John",
    "acctlastname": "Doe",
    "acctno": "123456789",
    "bankname": "Bank Central Asia",
    "branch": "Jakarta Pusat",
    "bankcity": "Jakarta",
    "country": "Indonesia",
    "swift": "CENAIDJAXXX",
    "recemail": "john.doe@example.com",
    "phonenumber": "123456789",
    "address": "100 Street 1"
}

fetch(url, {
    method: "PUT",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

$client = new \GuzzleHttp\Client();
$response = $client->put("//recipient/1", [
    'headers' => [
            "Authorization" => "Bearer tokenXXXX",
            "Content-Type" => "application/json",
        ],
    'query' => [
            "id" => "123",
        ],
    'json' => [
            "acctname" => "John",
            "acctlastname" => "Doe",
            "acctno" => "123456789",
            "bankname" => "Bank Central Asia",
            "branch" => "Jakarta Pusat",
            "bankcity" => "Jakarta",
            "country" => "Indonesia",
            "swift" => "CENAIDJAXXX",
            "recemail" => "john.doe@example.com",
            "phonenumber" => "123456789",
            "address" => "100 Street 1",
        ],
]);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

{
    "success": true,
    "recipientid": "86"
}

HTTP Request

PUT /recipient/{id}

Body Parameters

Parameter Type Status Description
acctname String required Account holder first name.
acctlastname String optional Last name of recipient.
acctno String required Account number of recipient.
bankname String required Name of recipient bank.
branch String required Branch of the bank.
bankcity String optional City of the bank.
country String required Destination country of transaction.
swift String optional Bank swift code.
recemail String optional Email of recipient.
phonenumber String optional Phone number of recipient.
address String optional Address of recipient.

Query Parameters

Parameter Status Description
id required The recipient id.

Transaction Management

All transaction management endpoints are access through https://transact.moolahgo.com/

Get a Quotation


Requires authentication This endpoint gets a quotation for a transaction. ( https://transact.moolahgo.com/listing/quote )

Example request:

curl -X GET -G "/listing/quote" \
    -H "Authorization: Bearer tokenXXXX" \
    -H "Content-Type: application/json" \
    -d '{"fromcurr":"SGD","tocurr":"IDR","fromamount":1000,"marketrate":false,"markup":0,"listingtype":"send","exrate":10339.618214546}'
const url = new URL("/listing/quote");

let headers = {
    "Authorization": "Bearer tokenXXXX",
    "Content-Type": "application/json",
    "Accept": "application/json",
}

let body = {
    "fromcurr": "SGD",
    "tocurr": "IDR",
    "fromamount": 1000,
    "marketrate": false,
    "markup": 0,
    "listingtype": "send",
    "exrate": 10339.618214546
}

fetch(url, {
    method: "GET",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

$client = new \GuzzleHttp\Client();
$response = $client->get("//listing/quote", [
    'headers' => [
            "Authorization" => "Bearer tokenXXXX",
            "Content-Type" => "application/json",
        ],
    'json' => [
            "fromcurr" => "SGD",
            "tocurr" => "IDR",
            "fromamount" => "1000",
            "marketrate" => "",
            "markup" => "0",
            "listingtype" => "send",
            "exrate" => "10339.618214546",
        ],
]);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

{
    "success": true,
    "status": "completed",
    "expectedcurrency": "SGD",
    "expectedamount": 1005
}

HTTP Request

GET /listing/quote

Body Parameters

Parameter Type Status Description
fromcurr String required Source currency code.
tocurr String required Destination currency code.
fromamount float required The amount to transact in source currency.
marketrate boolean optional Flag to indicate if the rate to be decided at the time of conversion (default: true).
markup float optional Percentage Markup/markdown from market rate (if marketrate=true, default: 0).
listingtype String optional 'send' or 'convert' (default: send).
exrate float optional The exchange rate from rate end point. If <=0 will be set to Moolahgo rate.

Get a Transaction


Requires authentication This endpoint get an existing listing in Moolahgo system. ( https://transact.moolahgo.com/listing )

Below are a list of status for a transaction:

Example request:

curl -X GET -G "/listing/1" \
    -H "Authorization: Bearer tokenXXXX"
const url = new URL("/listing/1");

    let params = {
            "id": "123",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer tokenXXXX",
    "Accept": "application/json",
    "Content-Type": "application/json",
}

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

$client = new \GuzzleHttp\Client();
$response = $client->get("//listing/1", [
    'headers' => [
            "Authorization" => "Bearer tokenXXXX",
        ],
    'query' => [
            "id" => "123",
        ],
]);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

{
    "success": true,
    "detail": {
        "listingid": "297",
        "sourcecurrency": "SGD",
        "destinationcurrency": "IDR",
        "sourceamount": "1000.00",
        "exchangerate": "10339.618214500000",
        "reason": "Business - Supplier Payments",
        "status": "Completed"
    }
}

HTTP Request

GET /listing/{id}

Query Parameters

Parameter Status Description
id required The pendingpaymentid or id of the listing to be obtained.

Create a Transaction


Requires authentication This endpoint creates a listing in Moolahgo system. ( https://transact.moolahgo.com/listing )

Example request:

curl -X POST "/listing" \
    -H "Authorization: Bearer tokenXXXX" \
    -H "Content-Type: application/json" \
    -d '{"fromcurr":"SGD","tocurr":"IDR","fromamount":1000,"marketrate":false,"markup":0,"listingtype":"send","reason":"Business - Supplier Payments","isp2p":false,"validity":10,"country":"Indonesia","exrate":10339.618214546,"recipientid":54,"senderfirstname":"John","senderlastname":"Doe","senderdob":"1990-12-31","senderic":"S1234567T","sendernationality":"Singaporean","senderaddress":"1 Shenton Way","senderemail":"john.doe@moolahgo.com"}'
const url = new URL("/listing");

let headers = {
    "Authorization": "Bearer tokenXXXX",
    "Content-Type": "application/json",
    "Accept": "application/json",
}

let body = {
    "fromcurr": "SGD",
    "tocurr": "IDR",
    "fromamount": 1000,
    "marketrate": false,
    "markup": 0,
    "listingtype": "send",
    "reason": "Business - Supplier Payments",
    "isp2p": false,
    "validity": 10,
    "country": "Indonesia",
    "exrate": 10339.618214546,
    "recipientid": 54,
    "senderfirstname": "John",
    "senderlastname": "Doe",
    "senderdob": "1990-12-31",
    "senderic": "S1234567T",
    "sendernationality": "Singaporean",
    "senderaddress": "1 Shenton Way",
    "senderemail": "john.doe@moolahgo.com"
}

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

$client = new \GuzzleHttp\Client();
$response = $client->post("//listing", [
    'headers' => [
            "Authorization" => "Bearer tokenXXXX",
            "Content-Type" => "application/json",
        ],
    'json' => [
            "fromcurr" => "SGD",
            "tocurr" => "IDR",
            "fromamount" => "1000",
            "marketrate" => "",
            "markup" => "0",
            "listingtype" => "send",
            "reason" => "Business - Supplier Payments",
            "isp2p" => "",
            "validity" => "10",
            "country" => "Indonesia",
            "exrate" => "10339.618214546",
            "recipientid" => "54",
            "senderfirstname" => "John",
            "senderlastname" => "Doe",
            "senderdob" => "1990-12-31",
            "senderic" => "S1234567T",
            "sendernationality" => "Singaporean",
            "senderaddress" => "1 Shenton Way",
            "senderemail" => "john.doe@moolahgo.com",
        ],
]);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

{
    "success": true,
    "status": "waiting for fee payment",
    "pendingpaymentid": 100,
    "expectedcurrency": "SGD",
    "expectedamount": 1012
}

HTTP Request

POST /listing

Body Parameters

Parameter Type Status Description
fromcurr String required Source currency code.
tocurr String required Destination currency code.
fromamount float required The amount to transact in source currency.
marketrate boolean optional Flag to indicate if the rate to be decided at the time of conversion (default: true).
markup float optional Percentage Markup/markdown from market rate (if marketrate=true, default: 0).
listingtype String optional 'send' or 'convert' (default: send).
reason String required The reason for the transaction (regulatory requirement).
isp2p boolean optional Flag to indicate if this submission is for peer to peer listing (default: false).
validity integer optional Number of days the listing should be active (only for peer to peer, default: 10).
country String required Destination country.
exrate float optional The exchange rate from rate end point. If <=0 will be set to Moolahgo rate.
recipientid integer required The id of recipient return from recipientrecord end point.
senderfirstname String optional Sender first name.
senderlastname String optional Sender last name.
senderdob String optional Sender date of birth in yyyy-mm-dd.
senderic String optional The IC of passport of sender.
sendernationality String optional Sender nationality.
senderaddress String optional Sender address.
senderemail String optional Sender email address.

Request Transaction Cancellation


Requires authentication This endpoint send a transaction cancellation request.

Example request:

curl -X DELETE "/listing/pendingpayment/1" \
    -H "Authorization: Bearer tokenXXXX"
const url = new URL("/listing/pendingpayment/1");

    let params = {
            "status": "pendingpayment",
            "id": "123",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer tokenXXXX",
    "Accept": "application/json",
    "Content-Type": "application/json",
}

fetch(url, {
    method: "DELETE",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

$client = new \GuzzleHttp\Client();
$response = $client->delete("//listing/pendingpayment/1", [
    'headers' => [
            "Authorization" => "Bearer tokenXXXX",
        ],
    'query' => [
            "status" => "pendingpayment",
            "id" => "123",
        ],
]);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

{
    "success": true
}

HTTP Request

DELETE /listing/{status}/{id}

Query Parameters

Parameter Status Description
status required 'pendingpayment' or 'active'.
id required Listing ID to be cancelled.