get daily transaction report file
you can call this API to download the file of a transaction reports.
endpoint: GET {{API_BASE_URL}}/reporting/paynow/daily/report/{{filename}}
the parameter {{filename}}
has the following format:
{{MERCHANT_SHORTCODE}}-{{yyyy-mm-dd}}-divit-daily-transaction.xlsx
example: MERCHANTX-2024-02-26-divit-daily-transaction.xlsx
.
you can find your MERCHANT_SHORTCODE
at the admin-portal
get transaction report
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}}/reporting/paynow/daily/report/MERCHANTX-2024-02-26-divit-daily-transaction.xlsx");
xhr.setRequestHeader("api-key", "{{API_KEY}}");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.send(data);
the endpoint will return the blob content with following headers:
content-type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
content-disposition: attachment; filename={filename}
response when report is not found​
important
system generates the previous day report at 02:00am HKT every day. you won't be able to download the report if there no transaction of the previous day or before the time it is being generated.
system returns a JSON response with the error code 8100
if the file is not found:
{
"code": 8100,
"message": "failed to find file MERCHANTX-2024-06-divit-daily-transaction.xlsx"
}