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.
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
}
}
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: */*