QM Developer Docs
Billing Reference

Create Bill

A bill serves as a request for payment. You can create a bill and send it to your customer for payment.

Create a bill.

POST /v1/bill/create HTTP/1.1
Content-Type: application/json
Key: {API Key}
Sign: {Signature}

{
    "amount": 0.00,
    "merchantReference": "string",
    "callbackUrl": "string",
    "redirectUrl": "string"
}

Request

Body

application/json
PropertyTypeDescription
amountnumberThe amount of the bill.
merchantReferencestringOptional. Your own reference number of the bill. Note that we do not check for uniqueness. If not specified, a reference number will be generated for you.
callbackUrlstringThe callback URL of the bill. This URL will be called upon bill status is final.
redirectUrlstringThe redirect URL of the bill. This should be your web page URL (or deeplink URL) where your customer will be redirected to upon payment complete.

Response

Body

application/json
{
  "code": 0,
  "message": "string",
  "data": {
    "billAmount": 0.0,
    "requireGCAmount": 0.0,
    "currency": "string",
    "merchantReference": "string",
    "billId": "string",
    "billUrl": "string",
    "expiredOn": 1706600000000
  }
}
PropertyTypeDescription
codenumberThe response code. Refer to ENUM Definition.
messagestringThe response message.
dataobjectThe response data.
data.billAmountnumberThe amount of the bill.
data.requireGCAmountnumberThe amount of Gold Convert required to pay the bill.
data.currencystringThe currency of the bill.
data.merchantReferencestringYour own reference number of the bill.
data.billIdstringThe unique ID of the bill. This ID will be required for requery and other operations.
data.billUrlstringThe URL of the bill that you will have to redirect the customer to or encode into a QR Code for customer to scan on their mobile device or QMGold app.
data.expiredOnnumberThe timestamp (in unix milliseconds) of the bill expiry.

Redirect

After the customer has completed the payment, they will be redirected to the redirectUrl that you have specified in the request.

It is not safe to rely on the Redirect to determine the status of the bill as you might be at risk of spoofing. You should always use the Requery Bill API to check the status of the bill.

Query Parameters

The following query parameters will be appended to the redirectUrl:

{redirectUrl}?billId={billId}&merchantReference={merchantReference}&status={status}
ParameterTypeDescription
billIdstringThe unique ID of the bill. This ID will be required for requery and other operations.
merchantReferencestringYour own reference number of the bill.
statusnumberThe status of the bill. Refer to ENUM Definition.

Callback

Upon bill status is final, we will call the callbackUrl that you have specified in the request.

It is not safe to rely on the Callback to determine the status of the bill as you might be at risk of spoofing. You should always use the Requery Bill API to check the status of the bill.

Body

The following JSON will be sent to the callbackUrl:

application/json
{
  "billId": "string",
  "merchantReference": "string",
  "requestReference": "string",
  "paymentReference": "string",
  "billAmount": "string",
  "currency": "string",
  "status": 0,
  "statusName": "string",
  "isFinal": bool,
  "dateTime": 1706600000000,
}
PropertyTypeDescription
billIdstringThe unique ID of the bill. This ID will be required for requery and other operations.
merchantReferencestringYour own reference number of the bill.
requestReferencestringThe request reference number of the request.
paymentReferencestringThe payment reference number of the payment.
billAmountnumberThe amount of the bill.
currencystringThe currency of the bill.
statusnumberThe status of the bill. Refer to ENUM Definition.
statusNamestringThe status name of the bill.
isFinalboolWhether the status of the bill is final.
dateTimenumberThe timestamp (in unix milliseconds) of the bill status update.

Callback Acknowledgement

You should always return a 200 OK response to acknowledge the callback. If you do not return a 200 OK response, we will retry the callback up to 5 times.


© 2023-2024 Quantum Metal Sdn Bhd