REST API
Introduction
Moyasar PG provides a simple and secure HTTPS endpoint that allows you to list, and download End-of-Day statement files.
There are two approaches to download End-of-Day statements:
Recommended: Download by Date
For daily automated downloads, use the by_date endpoint directly:
GET /v1/acquirer/eod_statements/by_date/:date.csv
This is the preferred method as it allows you to fetch the statement for a specific date without needing to first list all statements and extract the ID.
Alternative: Download by ID
If you need to browse available statements or download by UUID:
- 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.
You must login into the Acquirer Dashboard and generate an API key with the following permissions:
- eod_list
- eod_read
Service Endpoints
You can access the service on the following endpoints:
- Staging: https://pg.mysr.dev
- Production: https://pg.moyasar.com
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",
"version": "1.0",
"transactions": "500",
"created_at": "2024-02-04T18:40:27Z",
"updated_at": "2024-02-04T18:40:27Z"
},
{
"id": "cc1f878f-84ce-48db-804d-d818bc0d80b9",
"csv_file": "/v1/acquirer/eod_statements/cc1f878f-84ce-48db-804d-d818bc0d80b9.csv",
"date": "2024-02-04T00:00:00+03:00",
"version": "2.0",
"transactions": "500",
"created_at": "2024-02-04T18:40:27Z",
"updated_at": "2024-02-04T18:40:27Z"
},
{
"id": "01e70638-1d6b-473f-aedc-2dab22ffa683",
"csv_file": "/v1/acquirer/eod_statements/01e70638-1d6b-473f-aedc-2dab22ffa683.csv",
"date": "2024-02-04T00:00:00+03:00",
"version": "3.0",
"transactions": "500",
"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
}
}
Download End-of-Day Statement by Date (Recommended)
For daily automated downloads, use the by_date endpoint. This is the recommended approach as it eliminates the need to list statements and extract IDs.
Download CSV File
To download the CSV file directly, either append .csv to the URL or set the Accept header to text/csv:
GET /v1/acquirer/eod_statements/by_date/2024-12-07.csv
Authorization: Bearer acquirer_api_key_123
Or using the Accept header:
GET /v1/acquirer/eod_statements/by_date/2024-12-07
Authorization: Bearer acquirer_api_key_123
Accept: text/csv
Get Statement Metadata
If you omit the .csv extension and don't set the Accept header to text/csv, you will receive a JSON response with metadata about the statement:
GET /v1/acquirer/eod_statements/by_date/2024-12-07
Authorization: Bearer acquirer_api_key_123
Accept: application/json
Response:
{
"id": "018d756b-f97b-7bfe-835a-c706848f2498",
"csv_file": "/v1/acquirer/eod_statements/018d756b-f97b-7bfe-835a-c706848f2498.csv",
"date": "2024-12-07T00:00:00+03:00",
"version": "1.0",
"transactions": "500",
"created_at": "2024-12-07T18:40:27Z",
"updated_at": "2024-12-07T18:40:27Z"
}
Download End-of-Day Statement by ID
If you have the statement UUID (e.g., from the list endpoint), you can download it directly:
GET /v1/acquirer/eod_statements/018d756b-f97b-7bfe-835a-c706848f2498.csv
Authorization: Bearer acquirer_api_key_123