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.
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.

Client Credentials

Parameter
Description
client_id
This is a private identifier for your account
client_secret
This is a private key that should not be shared

Environments

Parameter
Description
Sandbox
Use endpoints in test mode and simulate real-like responses
Live
Work with live credentials to build applications

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
C#
Golang
Java
Node JS
PHP
Python
1
curl --location --request POST 'https://auth.reloadly.com/oauth/token' \
2
--header 'Content-Type: application/json' \
3
--data-raw '{
4
"client_id":"CLIENT_ID_GOES_HERE",
5
"client_secret":"CLIENT_SECRET_GOES_HERE",
6
"grant_type":"client_credentials",
7
"audience":"https://giftcards.reloadly.com"
8
}'
Copied!
1
using System;
2
using System.Threading.Tasks;
3
using System.Net.Http;
4
using System.Text;
5
using Newtonsoft.Json;
6
7
namespace WebAPIClient {
8
class Program {
9
10
static async Task Main(string[] args) {
11
await ApiCall();
12
}
13
14
private static async Task ApiCall() {
15
var json = JsonConvert.SerializeObject(new {
16
client_id = "YOUR_CLIENT_ID_HERE",
17
client_secret = "YOUR_CLIENT_SECRET_HERE",
18
grant_type = "client_credentials",
19
audience = "https://giftcards.reloadly.com"
20
});
21
22
var message = new HttpRequestMessage(HttpMethod.Post, "https://auth.reloadly.com/oauth/token"){
23
Content = new StringContent(json, Encoding.UTF8, "application/json")
24
};
25
26
message.Headers.TryAddWithoutValidation("Authorization", "Bearer YOUR_ACCESS_TOKEN_HERE");
27
message.Headers.TryAddWithoutValidation("Accept", "application/com.reloadly.giftcards-v1+json");
28
29
using
30
var httpClient = new HttpClient();
31
var response = await httpClient.SendAsync(message);
32
var responseBody = await response.Content.ReadAsStringAsync();
33
var result = JsonConvert.DeserializeObject < dynamic > (responseBody);
34
35
Console.WriteLine(result);
36
}
37
38
}
39
}
Copied!
1
package main
2
3
import (
4
"fmt"
5
"strings"
6
"net/http"
7
"io/ioutil"
8
)
9
10
func main() {
11
12
url := "https://auth.reloadly.com/oauth/token"
13
method := "POST"
14
15
payload := strings.NewReader(`{
16
"client_id":"YOUR_CLIENT_ID_HERE",
17
"client_secret":"YOUR_CLIENT_SECRET_HERE",
18
"grant_type":"client_credentials",
19
"audience":"https://giftcards.reloadly.com"
20
}`)
21
22
client := &http.Client {
23
}
24
req, err := http.NewRequest(method, url, payload)
25
26
if err != nil {
27
fmt.Println(err)
28
return
29
}
30
req.Header.Add("Content-Type", "application/json")
31
32
res, err := client.Do(req)
33
if err != nil {
34
fmt.Println(err)
35
return
36
}
37
defer res.Body.Close()
38
39
body, err := ioutil.ReadAll(res.Body)
40
if err != nil {
41
fmt.Println(err)
42
return
43
}
44
fmt.Println(string(body))
45
}
Copied!
1
OkHttpClient client = new OkHttpClient().newBuilder()
2
.build();
3
MediaType mediaType = MediaType.parse("application/json");
4
RequestBody body = RequestBody.create(mediaType, "{\n\t\"client_id\":\"YOUR_CLIENT_ID_HERE\",\n\t\"client_secret\":\"YOUR_ACCESS_TOKEN_HERE\",\n\t\"grant_type\":\"client_credentials\",\n\t\"audience\":\"https://giftcards.reloadly.com\"\n}");
5
Request request = new Request.Builder()
6
.url("https://auth.reloadly.com/oauth/token")
7
.method("POST", body)
8
.addHeader("Content-Type", "application/json")
9
.build();
10
Response response = client.newCall(request).execute();
Copied!
1
var request = require('request');
2
var options = {
3
'method': 'POST',
4
'url': 'https://auth.reloadly.com/oauth/token',
5
'headers': {
6
'Content-Type': 'application/json'
7
},
8
body: JSON.stringify({
9
"client_id": "YOUR_CLIENT_ID_HERE",
10
"client_secret": "YOUR_CLIENT_SECRET_HERE",
11
"grant_type": "client_credentials",
12
"audience": "https://giftcards.reloadly.com"
13
})
14
15
};
16
request(options, function (error, response) {
17
if (error) throw new Error(error);
18
console.log(response.body);
19
});
20
Copied!
1
<?php
2
3
$curl = curl_init();
4
5
curl_setopt_array($curl, array(
6
CURLOPT_URL => 'https://auth.reloadly.com/oauth/token',
7
CURLOPT_RETURNTRANSFER => true,
8
CURLOPT_ENCODING => '',
9
CURLOPT_MAXREDIRS => 10,
10
CURLOPT_TIMEOUT => 0,
11
CURLOPT_FOLLOWLOCATION => true,
12
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
13
CURLOPT_CUSTOMREQUEST => 'POST',
14
CURLOPT_POSTFIELDS =>'{
15
"client_id":"YOUR_CLIENT_ID_HERE",
16
"client_secret":"YOUR_CLIENT_SECRET_HERE",
17
"grant_type":"client_credentials",
18
"audience":"https://giftcards.reloadly.com"
19
}',
20
CURLOPT_HTTPHEADER => array(
21
'Content-Type: application/json'
22
),
23
));
24
25
$response = curl_exec($curl);
26
27
curl_close($curl);
28
echo $response;
29
Copied!
1
import requests
2
import json
3
4
url = "https://auth.reloadly.com/oauth/token"
5
6
payload = json.dumps({
7
"client_id": "YOUR_CLIENT_ID_HERE",
8
"client_secret": "YOUR_CLIENT_SECRET_HERE",
9
"grant_type": "client_credentials",
10
"audience": "https://giftcards.reloadly.com"
11
})
12
headers = {
13
'Content-Type': 'application/json'
14
}
15
16
response = requests.request("POST", url, headers=headers, data=payload)
17
18
print(response.text)
19
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
C#
Golang
Java
Node JS
PHP
Python
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
using System;
2
using System.Threading.Tasks;
3
using System.Net.Http;
4
using System.Text;
5
using Newtonsoft.Json;
6
7
namespace WebAPIClient {
8
class Program {
9
10
static async Task Main(string[] args) {
11
await ApiCall();
12
}
13
14
private static async Task ApiCall() {
15
var json = JsonConvert.SerializeObject(new {
16
countryCode: "US",
17
quantity: "1",
18
unitPrice: "1",
19
customIdentifier: "obucks10",
20
senderName: "John Doe",
21
recipientEmail: "[email protected]"
22
});
23
24
var message = new HttpRequestMessage(HttpMethod.Post, "https://giftcards.reloadly.com/orders") {
25
Content = new StringContent(json, Encoding.UTF8, "application/json")
26
};
27
28
message.Headers.TryAddWithoutValidation("Authorization", "Bearer YOUR_ACCESS_TOKEN_HERE");
29
message.Headers.TryAddWithoutValidation("Accept", "application/com.reloadly.giftcards-v1+json");
30
31
using
32
var httpClient = new HttpClient();
33
var response = await httpClient.SendAsync(message);
34
var responseBody = await response.Content.ReadAsStringAsync();
35
var result = JsonConvert.DeserializeObject < dynamic > (responseBody);
36
37
Console.WriteLine(result);
38
}
39
40
}
41
}
Copied!
1
package main
2
3
import (
4
"fmt"
5
"strings"
6
"net/http"
7
"io/ioutil"
8
)
9
10
func main() {
11
12
url := "https://giftcards.reloadly.com/orders"
13
method := "POST"
14
15
payload := strings.NewReader(`{
16
"productId": 120,
17
"countryCode": "US",
18
"quantity": 1,
19
"unitPrice": 1,
20
"customIdentifier": "obucks10",
21
"senderName": "John Doe",
22
"recipientEmail": "[email protected]"
23
}`)
24
25
client := &http.Client {
26
}
27
req, err := http.NewRequest(method, url, payload)
28
29
if err != nil {
30
fmt.Println(err)
31
return
32
}
33
req.Header.Add("Authorization", "Bearer YOUR_ACCESS_TOKEN_HERE")
34
req.Header.Add("Content-Type", "application/json")
35
req.Header.Add("Accept", "application/com.reloadly.giftcards-v1+json")
36
37
res, err := client.Do(req)
38
if err != nil {
39
fmt.Println(err)
40
return
41
}
42
defer res.Body.Close()
43
44
body, err := ioutil.ReadAll(res.Body)
45
if err != nil {
46
fmt.Println(err)
47
return
48
}
49
fmt.Println(string(body))
50
}
Copied!
1
OkHttpClient client = new OkHttpClient().newBuilder()
2
.build();
3
MediaType mediaType = MediaType.parse("application/json");
4
RequestBody body = RequestBody.create(mediaType, "{\n \"productId\": 120,\n \"countryCode\": \"US\",\n \"quantity\": 1,\n \"unitPrice\": 1,\n \"customIdentifier\": \"obucks10\",\n \"senderName\": \"John Doe\",\n \"recipientEmail\": \"[email protected]\"\n}");
5
Request request = new Request.Builder()
6
.url("https://giftcards.reloadly.com/orders")
7
.method("POST", body)
8
.addHeader("Authorization", "Bearer YOUR_ACCESS_TOKEN_HERE")
9
.addHeader("Content-Type", "application/json")
10
.addHeader("Accept", "application/com.reloadly.giftcards-v1+json")
11
.build();
12
Response response = client.newCall(request).execute();
Copied!
1
var request = require('request');
2
var options = {
3
'method': 'POST',
4
'url': 'https://giftcards.reloadly.com/orders',
5
'headers': {
6
'Authorization': 'Bearer YOUR_ACCESS_TOKEN_HERE',
7
'Content-Type': 'application/json',
8
'Accept': 'application/com.reloadly.giftcards-v1+json'
9
},
10
body: JSON.stringify({
11
"productId": 120,
12
"countryCode": "US",
13
"quantity": 1,
14
"unitPrice": 1,
15
"customIdentifier": "obucks10",
16
"senderName": "John Doe",
17
"recipientEmail": "[email protected]"
18
})
19
20
};
21
request(options, function (error, response) {
22
if (error) throw new Error(error);
23
console.log(response.body);
24
});
25
Copied!
1
<?php
2
3
$curl = curl_init();
4
5
curl_setopt_array($curl, array(
6
CURLOPT_URL => 'https:giftcards.reloadly.com/orders',
7
CURLOPT_RETURNTRANSFER => true,
8
CURLOPT_ENCODING => '',
9
CURLOPT_MAXREDIRS => 10,
10
CURLOPT_TIMEOUT => 0,
11
CURLOPT_FOLLOWLOCATION => true,
12
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
13
CURLOPT_CUSTOMREQUEST => 'POST',
14
CURLOPT_POSTFIELDS =>'{
15
"productId": 120,
16
"countryCode": "US",
17
"quantity": 1,
18
"unitPrice": 1,
19
"customIdentifier": "obucks10",
20
"senderName": "John Doe",
21
"recipientEmail": "[email protected]"
22
}',
23
CURLOPT_HTTPHEADER => array(
24
'Authorization: Bearer YOUR_ACCESS_TOKEN_HERE',
25
'Content-Type: application/json',
26
'Accept: application/com.reloadly.giftcards-v1+json'
27
),
28
));
29
30
$response = curl_exec($curl);
31
32
curl_close($curl);
33
echo $response;
Copied!
1
import requests
2
import json
3
4
url = "https:/giftcards.reloadly.com/orders"
5
6
payload = json.dumps({
7
"productId": 120,
8
"countryCode": "US",
9
"quantity": 1,
10
"unitPrice": 1,
11
"customIdentifier": "obucks10",
12
"senderName": "John Doe",
13
"recipientEmail": "[email protected]"
14
})
15
headers = {
16
'Authorization': 'Bearer YOUR_ACCESS_TOKEN_HERE',
17
'Content-Type': 'application/json',
18
'Accept': 'application/com.reloadly.giftcards-v1+json'
19
}
20
21
response = requests.request("POST", url, headers=headers, data=payload)
22
23
print(response.text)
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.
Last modified 14d ago