Fetch Transaction Endpoint

Endpoint

URL: /api/transactions/transaction

Methods: GET

Description

This API endpoint allows users to fetch a single transaction using either a transactionId or a requestId. Only one identifier is allowed per request.

Authentication

To access this endpoint, users must include their API key and secret key in the request headers.

Request Headers

  • api-key (string, required): The API key of the user.
  • secret-key (string, required): The secret key of the user.

Query Parameters

  • transactionId (string, optional): The unique transaction ID generated on our system for every transaction.
  • requestId (string, optional): The optional request ID included by the user when sending the transaction request.

Note: You must provide either transactionId orrequestId, but not both.

Usage Example

See usage examples in the code snippets below:

Example: Fetch by Transaction ID


GET /api/transactions/transaction?transactionId=20260208hskjhf567890
Content-Type: application/json
api-key: your-api-key
secret-key: your-secret-key

Example: Fetch by Request ID


GET /api/transactions/transaction?requestId=req_9a83ks73
Content-Type: application/json
api-key: your-api-key
secret-key: your-secret-key

Response:


- Status Code: 200

{
  "transactionId": "1234567890",
  "email": "user@example.com",
  "serviceType": "Airtime",
  "activity": "MTN VTU",
  "status": "Successful",
  "recipient": "08032566178",
  "amount": 100,
  "amountUsed": 99,
  "initialBalance": 500,
  "finalBalance": 401,
  "Method": "API",
  "createdAt": "2025-01-20T12:30:00.000Z",
  "updatedAt": "2025-01-20T12:30:01.000Z"
}

Failed Response Format


- Status Code: 400

{
  "error": "transactionId or requestId is required"
}

- Status Code: 400

{
  "error": "Provide only one identifier"
}

- Status Code: 404

{
  "error": "Transaction not found"
}

Other Error Responses

  • 401 Unauthorized: Invalid API key or secret key.
  • 400 Bad Request: Missing or conflicting query parameters.
  • 404 Not Found: Transaction not found.
  • 500 Internal Server Error: Internal server error occurred.
IABCONCEPT