How to fetch transaction data for all the top-ups made on your account

Raphael Ugwu

Raphael Ugwu

2 min

Keeping track of your airtime and data top-ups is important, especially if you make different top-ups on various mobile numbers over an amount of time. This guide will walk you through how to achieve this. Steps to be followed in this guide are:

  • Getting your access token for the top-up service
  • Retrieving your top-up transaction details.

You can get your access token by following the steps in this quickstart.

Retrieving top-up transaction details

Assuming you want to view top-up transaction details for your account , you can achieve this by making a request to Reloadly’s Airtime API. The cURL code snippet below shows how you can achieve this:

curl -i -X GET \
  'https://topups-sandbox.reloadly.com/reports/transactions' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>'

If successful, you will receive a JSON snippet containing details of all the top-ups ever made on your account

{
    "content": [
        {
            "transactionId": 2045174,
            "status": "SUCCESSFUL",
            "operatorTransactionId": "2021032318175785707776813",
            "customIdentifier": null,
            "recipientPhone": "2348147658720",
            "recipientEmail": null,
            "senderPhone": "13056154908",
            "countryCode": "NG",
            "operatorId": 341,
            "operatorName": "MTN Nigeria",
            "discount": 0,
            "discountCurrencyCode": "NGN",
            "requestedAmount": 100,
            "requestedAmountCurrencyCode": "NGN",
            "deliveredAmount": 100,
            "deliveredAmountCurrencyCode": "NGN",
            "transactionDate": "2021-03-23 13:17:08",
            "pinDetail": null,
            "balanceInfo": null
          },
          {
            "transactionId": 2053761,
            "status": "SUCCESSFUL",
            "operatorTransactionId": "2021032418372382005005558",
            "customIdentifier": "topup-441",
            "recipientPhone": "2348147658720",
            "recipientEmail": null,
            "senderPhone": null,
            "countryCode": "NG",
            "operatorId": 341,
            "operatorName": "MTN Nigeria",
            "discount": 0,
            "discountCurrencyCode": "NGN",
            "requestedAmount": 100,
            "requestedAmountCurrencyCode": "NGN",
            "deliveredAmount": 100,
            "deliveredAmountCurrencyCode": "NGN",
            "transactionDate": "2021-03-24 13:37:22",
            "pinDetail": null,
            "balanceInfo": null
          },
          {
            "transactionId": 2107881,
            "status": "SUCCESSFUL",
            "operatorTransactionId": "2021033014190088206997458",
            "customIdentifier": "This is example identifier",
            "recipientPhone": "2348147658720",
            "recipientEmail": null,
            "senderPhone": "2348147658720",
            "countryCode": "NG",
            "operatorId": 341,
            "operatorName": "MTN Nigeria",
            "discount": 0,
            "discountCurrencyCode": "NGN",
            "requestedAmount": 100,
            "requestedAmountCurrencyCode": "NGN",
            "deliveredAmount": 100,
            "deliveredAmountCurrencyCode": "NGN",
            "transactionDate": "2021-03-30 09:18:59",
            "pinDetail": null,
            "balanceInfo": null
          }
    ],
    "pageable": {
        "sort": {
          "sorted": false,
          "unsorted": true,
          "empty": true
        },
        "pageNumber": 0,
        "pageSize": 1,
        "offset": 0,
        "paged": true,
        "unpaged": false
      },
      "totalElements": 3,
      "last": true,
      "totalPages": 1,
      "first": true,
      "sort": {
        "sorted": false,
        "unsorted": true,
        "empty": true
      },
      "numberOfElements": 3,
      "size": 3,
      "number": 0,
      "empty": false
 }

Resources

Reloadly Airtime API

Reloadly Developer Documentation

This might also interest you:

Content by developers to developers.

Subscribe to The Monthly Reload for Developers and start receiving all the developers’ updates.

The Monthly Reload: the newsletter for you

Subscribe to our Newsletter and don’t miss any news about our industry and products.

It’s time to build, make your first API call today