When building an application with Reloadly’s Gift Card API, your application makes gift card orders from your wallet balance. This creates the need to keep an eye on your balance in real time.
This guide shows you how to how to embed an API request in any of your gift card applications that shows you the data of your wallet’s balance in real time. With this, you can avoid running low when making multiple gift card orders
The objective of this guide can be achieved with the following steps:
- Getting your access token from the Gift Card 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://giftcards.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.