Transactions

A transaction is the persistent record of a payment. One session → one transaction. Each transaction has zero or more payment attempts (one per gateway retry).

List transactions

bash
GET /api/v1/transactions?status=SUCCESS&page=0&size=20
X-Api-Key: mp_test_...

Returns a paginated response sorted by createdAt DESC:

json
{
  "items": [
    {
      "id": "8f8a…",
      "amount": 199.50,
      "currency": "SAR",
      "status": "SUCCESS",
      "gatewayType": "MOYASAR",
      "gatewayTransactionId": "pay_abc",
      "customerEmail": "c@x.com",
      "createdAt": "2026-05-26T12:00:00Z",
      "environment": "TEST"
    }
  ],
  "page": 0,
  "size": 20,
  "total": 142,
  "totalPages": 8
}

Get details

bash
GET /api/v1/transactions/{id}

Returns the transaction together with every attempt (useful for debugging gateway failures).

Auto-pagination in the SDK

ts
for await (const tx of minnha.transactions.iterate({ status: "FAILED" })) {
  console.log(tx.id);
}

Export to Excel

Any list endpoint with /export returns an .xlsx. Default range is the last 30 days; max range is 31 days.

bash
GET /api/v1/transactions/export?from=2026-05-01&to=2026-05-31