How to check your wallet balance with Reloadly’s Airtime API

Raphael Ugwu

Raphael Ugwu

< 1

When working with Reloadly’s Airtime API, your application makes top-ups, from your wallet balance. This creates the need to keep an eye on your balance in real time.

That’s what this guide is about – how to embed an API request in any of your airtime applications that shows you the data of your wallet’s balance in real time. This can be useful in making key decisions such as how periodically you will recharge your wallet.

The objective of this guide can be achieved with the following steps:

  • Getting your access token from the Airtime authentication service
  • Make the request for the wallet balance

You can get your access token by following the steps in this quickstart. The cURL code sample below specifies how you can then use your access token to make a request to check your wallet balance.

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

If your request is successful, you should receive a response similar to the following

{
  "balance": 5000,
  "currencyCode": "USD",
  "currencyName": "US Dollar",
  "updatedAt": "2021-12-04 08:45:51"
}

This response can be made functional in a number of ways. For instance, you can create an alert to occur when a particular threshold is crossed in the value of the balance property.

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