GiftCards
Search…
Quickstart

Authorization

The quickest way to get started with our GiftCard product is to order a gift card. The first step to achieving this is by signing up on the Reloadly dashboard and retrieving your client credentials.
API credentials
On the dashboard, you can get your client credentials by navigating to the Developers > API settings section

Choose your environment

Asides from the live environment, Reloadly provides a sandbox (also called test environment) where you can simulate real-life scenarios and use cases for each API endpoint. If you would like to first work with the test environment, you can check out the virtual sandbox in the DevTools section.

Get your access token

Once you have your client credentials, the next step is for you to retrieve your access token. Reloadly issues access tokens - also known as bearer tokens - that are used to authorize API requests. Using the body parameters below, you can make a request to the API and obtain your access token
cURL
HTTPie
1
curl
2
--location --request POST 'https://auth.reloadly.com/oauth/token' \
3
--header 'Content-Type: application/json' \
4
--data-raw '{
5
"client_id":"CLIENT_ID_GOES_HERE",
6
"client_secret":"CLIENT_SECRET_GOES_HERE",
7
"grant_type":"client_credentials",
8
"audience":"https://giftcards.reloadly.com"
9
}'
Copied!
1
http --follow POST 'https://auth.reloadly.com/oauth/token' \
2
'Content-Type: application/json' \
3
client_id=CLIENT_ID_GOES_HERE \
4
client_secret=CLIENT_SECRET_GOES_HERE \
5
grant_type=client_credentials \
6
audience=https://giftcards.reloadly.com
Copied!
Once successful, you will get response data containing your access token, its privileges, and its lifespan
JSON
1
{
2
"access_token":"eyJraWQiOiIwMDA1YzFmMC0xMjQ3LTRmNmUtYjU2ZC1jM2ZkZDVmMzhhOTIiLCJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9",
3
"scope":"send-topups read-operators read-promotions read-topups-history read-prepaid-balance read-prepaid-commissions",
4
"expires_in":5184000,
5
"token_type":"Bearer"
6
}
Copied!
Reloadly's API uses the REST architecture thus all responses are in JSON

Purchasing your first gift card

Using your access token, the next step is to make a gift card purchase. Reloadly provides access to over 200 gift cards in more than 140 countries. With this, you've got a lot of options when purchasing a gift card. To purchase a gift card, you can make a POST request to the /orders endpoint
cURL
HTTPie
1
curl --location --request POST 'https://giftcards.reloadly.com/orders' \
2
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN_HERE' \
3
--header 'Content-Type: application/json' \
4
--header 'Accept: application/com.reloadly.giftcards-v1+json' \
5
--data-raw '{
6
"productId": 120,
7
"countryCode": "US",
8
"quantity": 1,
9
"unitPrice": 1,
10
"customIdentifier": "obucks10",
11
"senderName": "John Doe",
12
"recipientEmail": "[email protected]"
13
}'
Copied!
1
http --follow POST 'https://giftcards.reloadly.com/orders' \
2
'Content-Type: application/json' \
3
'Authorization: Bearer YOUR_ACCESS_TOKEN_HERE' \
4
'Accept: application/com.reloadly.giftcards-v1+json' \
5
productId=120 \
6
countryCode=US \
7
quantity=1 \
8
unitPrice=1 \
9
customIdentifier=obucks10 \
10
senderName="John Doe" \
11
recipientEmail=[email protected]
Copied!
Should the request be successful, you will get a response containing details of your purchase
JSON
1
{
2
"transactionId":35,
3
"amount":9372.0495,
4
"discount":545.46,
5
"currencyCode":"NGN",
6
"recipientEmail":"[email protected]",
7
"customIdentifier":"obucks14",
8
"status":"SUCCESSFUL",
9
"date":"2021-07-19 05:35:01",
10
"product":{
11
"productId":1,
12
"productName":"1-800-PetSupplies",
13
"countryCode":"US",
14
"quantity":1,
15
"unitPrice":25,
16
"totalPrice":25,
17
"currencyCode":"USD",
18
"brand":{
19
"brandId":1,
20
"brandName":"1-800-PetSupplies"
21
}
22
}
23
}
Copied!

Next steps

Awesome! You have gotten started with Reloadly's GiftCard API in the fastest way possible. You can alter the code samples above in order to get more practice with our API or take a deep dive through Reloadly's Postman collection for more hands-on experience. You can also check out the rest of the documentation for a deeper understanding of the GiftCard product.