Skip to main content
POST
/
gift-cards
/
balances
Verify and check gift card balances
using RestSharp;


var options = new RestClientOptions("https://api.sandbox.{id}.gr4vy.app/gift-cards/balances");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{}", false);
var response = await client.PostAsync(request);

Console.WriteLine("{0}", response.Content);
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.sandbox.{id}.gr4vy.app/gift-cards/balances"

payload := strings.NewReader("{}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.sandbox.{id}.gr4vy.app/gift-cards/balances")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{}")
.asString();
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.{id}.gr4vy.app/gift-cards/balances",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([

]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests

url = "https://api.sandbox.{id}.gr4vy.app/gift-cards/balances"

payload = {}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};

fetch('https://api.sandbox.{id}.gr4vy.app/gift-cards/balances', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
curl --request POST \
--url https://api.sandbox.{id}.gr4vy.app/gift-cards/balances \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'
{
  "items": [
    {
      "type": "gift-card",
      "id": "e6cdf979-87e2-4796-8ff6-9784d5aed893",
      "merchant_account_id": "default",
      "bin": "412345",
      "sub_bin": "554",
      "last4": "1234",
      "expiration_date": "2013-07-16T19:23:00.000+00:00",
      "balance": 1299,
      "currency": "USD",
      "balance_error_code": "incorrect_currency",
      "balance_raw_error_code": "10363",
      "balance_raw_error_message": "This currency is not supported by the merchant."
    }
  ]
}
{
"type": "error",
"code": "bad_request",
"status": 400,
"message": "Missing '****' field",
"details": [
{
"location": "body",
"type": "value_error.missing",
"pointer": "/payment_method/number",
"message": "field required"
}
]
}
{
"type": "error",
"code": "unauthorized",
"status": 401,
"message": "No valid API authentication found",
"details": []
}
{
"type": "error",
"code": "too_many_requests",
"status": 429,
"message": "Too many requests",
"details": []
}
This endpoint requires the gift-cards.read scope.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

A request to check the balance for a set of stored and non-stored gift cards.

items
(Gift Card Balance (New) · object | Gift Card Balance (Stored) · object)[]

One or more gift cards to check balances for, up to a default limit of 10 gift cards. Please contact our team to change this limit.

Minimum array length: 1

Check the balance for a non-stored gift card.

Response

Returns the balances for each of the gift cards. Balances are returned in the same order they are requested.

A list of gift cards in a short format including the latest balance.

items
A stored gift card (summary) · object[]

A list of stored gift cards.