Skip to main content
GET
/
gift-cards
/
{gift_card_id}
C#
using Gr4vy;
using Gr4vy.Models.Components;

var sdk = new Gr4vySDK(
    id: "example",
    server: SDKConfig.Server.Sandbox,
    bearerAuthSource: Auth.WithToken(privateKey),
    merchantAccountId: "default"
);

var res = await sdk.GiftCards.GetAsync(giftCardId: "356d56e5-fe16-42ae-97ee-8d55d846ae2e");

// handle response
package main

import(
"context"
"os"
gr4vygo "github.com/gr4vy/gr4vy-go"
"log"
)

func main() {
ctx := context.Background()

s := gr4vygo.New(
gr4vygo.WithMerchantAccountID("default"),
gr4vygo.WithSecurity(os.Getenv("GR4VY_BEARER_AUTH")),
)

res, err := s.GiftCards.Get(ctx, "356d56e5-fe16-42ae-97ee-8d55d846ae2e")
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
package hello.world;

import com.gr4vy.sdk.Gr4vy;
import com.gr4vy.sdk.models.errors.*;
import com.gr4vy.sdk.models.operations.GetGiftCardResponse;
import java.lang.Exception;

public class Application {

public static void main(String[] args) throws Exception {

Gr4vy sdk = Gr4vy.builder()
.merchantAccountId("default")
.bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
.build();

GetGiftCardResponse res = sdk.giftCards().get()
.giftCardId("356d56e5-fe16-42ae-97ee-8d55d846ae2e")
.call();

if (res.giftCard().isPresent()) {
System.out.println(res.giftCard().get());
}
}
}
declare(strict_types=1);

require 'vendor/autoload.php';

use Gr4vy;

$sdk = Gr4vy\SDK::builder()
->setId('example')
->setServer('sandbox')
->setSecuritySource(Auth::withToken($privateKey))
->setMerchantAccountId('default')
->build();



$response = $sdk->giftCards->get(
giftCardId: '356d56e5-fe16-42ae-97ee-8d55d846ae2e'
);

if ($response->giftCard !== null) {
// handle response
}
from gr4vy import Gr4vy
import os


with Gr4vy(
id="example",
server="sandbox",
merchant_account_id="default",
bearer_auth=auth.with_token(open("./private_key.pem").read())
) as g_client:

res = g_client.gift_cards.get(gift_card_id="356d56e5-fe16-42ae-97ee-8d55d846ae2e")

# Handle response
print(res)
import { Gr4vy, withToken } from "@gr4vy/sdk";
import fs from "fs";

const gr4vy = new Gr4vy({
id: "example",
server: "sandbox",
merchantAccountId: "default",
bearerAuth: withToken({
privateKey: fs.readFileSync("private_key.pem", "utf8"),
}),
});

async function run() {
const result = await gr4vy.giftCards.get("356d56e5-fe16-42ae-97ee-8d55d846ae2e");

console.log(result);
}

run();
curl --request GET \
--url https://api.sandbox.{id}.gr4vy.app/gift-cards/{gift_card_id} \
--header 'Authorization: Bearer <token>'
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "merchant_account_id": "<string>",
  "gift_card_service": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "display_name": "<string>",
    "type": "gift-card-service"
  },
  "bin": "<string>",
  "sub_bin": "<string>",
  "last4": "<string>",
  "created_at": "2023-11-07T05:31:56Z",
  "updated_at": "2023-11-07T05:31:56Z",
  "usage_count": 123,
  "cit_usage_count": 123,
  "type": "gift-card",
  "expiration_date": "2013-07-16T19:23:00.000+00:00",
  "buyer": {
    "merchant_account_id": "<string>",
    "created_at": "2023-11-07T05:31:56Z",
    "updated_at": "2023-11-07T05:31:56Z",
    "type": "buyer",
    "id": "fe26475d-ec3e-4884-9553-f7356683f7f9",
    "display_name": "John Doe",
    "external_identifier": "buyer-12345",
    "billing_details": {
      "first_name": "John",
      "last_name": "Doe",
      "email_address": "john@example.com",
      "phone_number": "+1234567890",
      "address": {
        "city": "San Jose",
        "country": "US",
        "postal_code": "94560",
        "state": "California",
        "state_code": "US-CA",
        "house_number_or_name": "10",
        "line1": "Stafford Appartments",
        "line2": "29th Street",
        "organization": "Gr4vy"
      },
      "tax_id": {
        "value": "<string>"
      }
    },
    "account_number": "<string>"
  },
  "last_used_at": "2013-07-16T19:23:00.000+00:00",
  "cit_last_used_at": "2013-07-16T19:23:00.000+00:00"
}
{
"type": "error",
"code": "bad_request",
"status": 400,
"message": "Generic error",
"details": []
}
{
"type": "error",
"code": "unauthorized",
"status": 401,
"message": "No valid API authentication found",
"details": []
}
{
"type": "error",
"code": "forbidden",
"status": 403,
"message": "Generic error",
"details": []
}
{
"type": "error",
"code": "not_found",
"status": 404,
"message": "The resource could not be found",
"details": []
}
{
"type": "error",
"code": "method_not_allowed",
"status": 405,
"message": "Method Not Allowed",
"details": []
}
{
"type": "error",
"code": "duplicate_record",
"status": 409,
"message": "Generic error",
"details": [],
"resource_id": "cdc70639-cb9c-4222-a73f-b8ce39f7821b"
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}
{
"type": "error",
"code": "too_early",
"status": 425,
"message": "Generic error",
"details": []
}
{
"type": "error",
"code": "too_many_requests",
"status": 429,
"message": "Generic error",
"details": []
}
{
"type": "error",
"code": "server_error",
"status": 500,
"message": "Request could not be processed",
"details": []
}
{
"type": "error",
"code": "bad_gateway",
"status": 502,
"message": "Request could not be processed",
"details": []
}
{
"type": "error",
"code": "gateway_timeout",
"status": 504,
"message": "Request could not be processed",
"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.

Headers

x-gr4vy-merchant-account-id
string

The ID of the merchant account to use for this request.

Example:

"default"

Path Parameters

gift_card_id
string<uuid>
required

The ID of the gift card.

Example:

"356d56e5-fe16-42ae-97ee-8d55d846ae2e"

Response

Successful Response

id
string<uuid>
required

The ID for the gift card.

Example:

"356d56e5-fe16-42ae-97ee-8d55d846ae2e"

merchant_account_id
string
required

The ID of the merchant account this buyer belongs to.

Example:

"default"

gift_card_service
GiftCardService · object
required

The service this gift card belongs to.

bin
string
required

The first 6 digits of the full gift card number.

Example:

"412345"

sub_bin
string
required

The 3 digits after the bin of the full gift card number.

Example:

"554"

last4
string
required

The last 4 digits for the gift card.

Example:

"1234"

created_at
string<date-time>
required

The date this gift card record was created at.

Example:

"2013-07-16T19:23:00.000+00:00"

updated_at
string<date-time>
required

The date this gift card record was last updated at.

Example:

"2013-07-16T19:23:00.000+00:00"

usage_count
integer
required

The number of times this gift card has been used in transactions.

Example:

100

cit_usage_count
integer
required

The number of times this gift card has been used in transactions for client initiated transactions.

Example:

50

type
string
default:gift-card

Always gift-card.

Allowed value: "gift-card"
Example:

"gift-card"

expiration_date
string<date-time> | null

The date and time when this gift card expires. This is a full date/time and may be more accurate than the actual expiry date received by the gift card service.

Example:

"2013-07-16T19:23:00.000+00:00"

buyer
Buyer · object | null

The buyer for which this gift card is stored.

last_used_at
string<date-time> | null

The timestamp when this gift card was last used in a transaction.

Example:

"2013-07-16T19:23:00.000+00:00"

cit_last_used_at
string<date-time> | null

The timestamp when this gift card was last used in a transaction for client initiated transactions.

Example:

"2013-07-16T19:23:00.000+00:00"