Skip to main content

check order status

you can call this API to get the latest status of the order, including the payment status and refund amount.

endpoint: GET [API_BASE_URL]/paynow/orders/{orderID}/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", "https://sandbox-api.divit.dev/paynow/orders/{orderID}/status");
xhr.setRequestHeader("api-key", "<your 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",
"merchantRef": "1702905618115",
"orderAmount": { "amount": 40000, "currency": "HKD" },
"status": "completed",
"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" },
"totalRefundCompleted": { "amount": 0, "currency": "HKD" }
}
}
}