Skip to main content

check order status

the order might not be available until there is a payment event happened at divit.

endpoint: GET {{API_BASE_URL}}/paynow/orders/{{DIVIT_ORDER_ID}}/status

get order status

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});

xhr.open("GET", "{{API_BASE_URL}}/paynow/orders/{{DIVIT_ORDER_ID}}/status");
xhr.setRequestHeader("api-key", "{{API_KEY}}"); // e.g. dvt_rREeGJ4FXp69nQEJ7Arq08stvtacFyPrTzKr>
xhr.setRequestHeader("Content-Type", "application/json");

xhr.send(data);
sample response
{
"value": {
"code": 0,
"message": "OK",
"data": {
"orderID": "c3222a2f-2908-468d-b0a8-7c64f3a21b4c", // DIVIT_ORDER_ID
"merchantRef": "1702905618115",
"orderAmount": { "amount": 40000, "currency": "HKD" },
"status": "completed", // order status
"instalments": [{
"instalmentSeriesID": 1,
"status": "paid",
"instalmentAmount": { "amount": 40000, "currency": "HKD" }
}],
"merchantFee": { "amount": 400, "currency": "HKD" },
"customerFee": { "amount": 0, "currency": "HKD" },
"totalRefundRequested": { "amount": 15000, "currency": "HKD" }, // refund requested
"totalRefundCompleted": { "amount": 0, "currency": "HKD" } // refund completed
}
}
}