REST API
Introduction
Moyasar PG provides a simple and secure HTTPS endpoint that allows you to list, and download End-of-Day statement files.
To download the End-of-Day statement file using REST API approach you need to perform the following steps:
- List End-of-Day statements
- Make note of the End-of-Day statement ID
- Download the End-of-Day statement using the acquired ID
Prerequistes
This guide assumes you are a registered acquirer within Moyasar and you have an acquirer API key to access the service.
The API key must have the following permissions assigned to it:
- eod_list
- eod_read
Service Endpoints
You can access the service on the following endpoints:
- Staging: https://pg.mysr.dev
Authentication
Moyasar PG uses Bearer authentication mechanism to authenticate API requests. Using your acquirer API key, you need to include the following header in your HTTP requests:
Authorization: Bearer <your_api_key`>
List End-of-Day statements
Using your acquirer API key, perform the following GET HTTP request:
GET /v1/acquirer/eod_statements
Authorization: Bearer acquirer_api_key_123
Accept: application/json
On a successful response, you will get a list of statements (ordered by created_at desc):
{
"eod_statements": [
{
"id": "018d756b-f97b-7bfe-835a-c706848f2498",
"csv_file": "/v1/acquirer/eod_statements/018d756b-f97b-7bfe-835a-c706848f2498.csv",
"date": "2024-02-04T00:00:00+03:00",
"created_at": "2024-02-04T18:40:27Z",
"updated_at": "2024-02-04T18:40:27Z"
}
],
"meta": {
"current_page": 1,
"next_page": null,
"prev_page": null,
"total_pages": 1,
"total_count": 1
}
}
Make note of the End-of-Day statement ID
Using the previous example, we want to download the EOD statement for the day 2024-02-04. The ID for that statement is 018d756b-f97b-7bfe-835a-c706848f2498.
Download the End-of-Day statement using the acquired ID
Using the ID of the statement, initiate a GET request to get the statement file.
Note: this endpoint will return the raw CSV file.
GET /v1/acquirer/eod_statements/018d756b-f97b-7bfe-835a-c706848f2498.csv
Authorization: Bearer acquirer_api_key_123
Accept: */*