Skip to main content

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-short-code}-{yyyy-mm-dd}-divit-daily-transaction.xlsx

example: MERCHANTX-2024-02-26-divit-daily-transaction.xlsx. you can obtain the merchant-short-code when your merchant account is created

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", "https://sandbox-api.divit.dev/reporting/paynow/daily/report/MERCHANTX-2024-02-26-divit-daily-transaction.xlsx");
xhr.setRequestHeader("api-key", "<your api-key, e.g. dvt_rREeGJ4FXp69nQEJ7Arq08stvtacFyPrTzKr>");
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 2:00am 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"
}