Issue and redeem cards
Build your own gift card platform on the Globagift API. Issue and deliver cards, handle claims, redeem at signed acceptance points, manage cards, and follow activity with reports and webhooks.
This guide follows a card from issue to redemption, for a platform that sells a merchant's gift cards through its own checkout and tills. Each step links to the full operation in the reference.
How a card works
A card has three identifiers:
| Identifier | Who sees it | Used for |
|---|---|---|
Card id | Your systems | Reading and managing the card with your API key |
| Claim code | The recipient, once | Opening the card and revealing its redemption code |
| Redemption code | The cardholder | Spending the card and checking its balance |
A card moves through these states:
| State | Meaning |
|---|---|
active | Issued with its full balance |
partially_redeemed | Some of the balance has been spent |
depleted | The whole balance has been spent |
suspended | Temporarily blocked; can be released |
fraud_hold | Held by Globagift's fraud screening |
expired | Past its expiry date |
voided | Cancelled |
Only active and partially_redeemed cards can be claimed or redeemed.
Issue a card
After your checkout has taken payment, issue the card with POST /v1/cards. Use a key with cards:issue, and use your order line as the Idempotency-Key, so a retry never issues a second card.
curl -s -X POST "$GG_BASE/v1/cards" \
-H "Authorization: Bearer $GG_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: order-1001-line-1" \
-d '{"card_product_id":"PRODUCT_ID","amount":5000,"payment_reference":"PAY-88213"}'The amount must be within the product's range, and the product must be active. Optional fields:
payment_reference: your payment reference, to reconcile tills and sales.acceptance_point_id: the till or site that sold the card.delivery_channel: how the card reaches the recipient. See below.
The response includes the claim_code once. Store it before you acknowledge the sale.
Deliver the card
Choose a delivery_channel when you issue:
| Channel | What happens |
|---|---|
qr (default) | Nothing is sent. You deliver the card yourself, using the codes in the response. |
email | Globagift emails the gift card to recipient_email. This is the default when recipient_email is set. |
whatsapp | Globagift sends the gift card to recipient_phone (E.164 format). Requires whatsapp_consent: true, recorded from the recipient's opt-in. |
Claiming replaces the redemption code
When a card is claimed for the first time with POST /v1/claims, Globagift issues a new redemption code and the code returned at issue stops working. Claiming again returns the same new code.
Choose one path for each card:
- Hand over the card directly, for example printed at a till: give the cardholder the
redemption_codefrom the issue response and do not share the claim code. - Send a claim link or code: give the recipient only the claim code. Your claim page calls
POST /v1/claimsand shows the redemption code and theqr_data_urlimage it returns.
Do not show both, or the cardholder may hold a code that no longer works.
Build a claim page
POST /v1/claims needs no API key, so a cardholder's browser or app can call it. Along with the redemption code it returns the balance, currency, merchant and product names, artwork and expiry for you to display. An unknown, voided or expired claim code returns 404.
The endpoint is rate limited per IP address. See Rate limits.
Check a balance
Two endpoints read a balance by redemption code:
GET /v1/balanceis public and returns only the balance and currency. Use it for cardholder balance checks.GET /v1/pos/cards/lookupneeds a key withcards:readand also returns the card id, status, product and expiry. Use it at a till before redeeming.
Redeem at an acceptance point
Redemptions are signed by an acceptance point, not authorised by an API key. Set up the acceptance point and its credential first, as described in Signed requests from acceptance points.
import { signedHeaders } from './sign.mjs';
const path = '/v1/redemptions';
const body = JSON.stringify({ code: redemptionCode, amount: 1500 });
const response = await fetch(`https://engine-sandbox.globagift.io${path}`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Idempotency-Key': `till-7-receipt-${receiptNumber}`,
...signedHeaders({ credentialId, secret, method: 'POST', path, body }),
},
body,
});A successful redemption returns 201:
{
"id": "e5a7c3d1-2f8b-4e69-a0d4-7b1c9e3f5a62",
"card_id": "c41d8e2a-0b6f-4a3c-9e57-1f2a8b6d3e90",
"amount": 1500,
"remaining_balance": 3500,
"card_state": "partially_redeemed"
}Cards can be spent in several redemptions until the balance reaches zero. A redemption for more than the balance is refused with insufficient_balance. Nothing is taken, so ask the cardholder for another payment method for the difference and redeem the card's remaining balance.
If the response is lost, retry with the same Idempotency-Key and body and a new signature. You get the original redemption back with 200, and the card is charged once.
Manage cards
With a key that has cards:manage:
POST /v1/cards/{id}/suspendblocks a card, for example while a dispute is checked. Redemptions are refused withcard_not_redeemable.POST /v1/cards/{id}/releasereturns a suspended card to its previous state.POST /v1/cards/{id}/voidcancels a card. Its claim and redemption codes stop working.
List cards with GET /v1/cards, filtering by state, issue date, recipient email or the last four characters of the redemption code. List redemptions with GET /v1/redemptions.
Reports
With a key that has reports:read:
GET /v1/reports/activitytotals sales and redemptions by currency over the lastdaysdays (30 by default).GET /v1/reports/outstanding-liabilitygives the unspent balance across your cards by currency. This is value owed to cardholders, not revenue.GET /v1/reports/breakage-aginggroups that outstanding balance by age.
Webhooks
Webhooks tell your systems when something happens to a card, so you do not need to poll.
Create a subscription with POST /v1/webhook-subscriptions using a key with webhooks:write. Give an https URL on a public DNS name and the event types you want. The response includes a signing secret, shown once.
{ "url": "https://example.com/globagift/webhooks", "types": ["card.issued", "card.claimed", "card.redeemed"] }Card and product event types include:
| Event | When |
|---|---|
card.issued | A card is issued |
card.claimed | A card is claimed |
card.redeemed | A redemption is made |
card.redemption_reversed | A redemption is reversed |
card.suspended, card.released, card.voided | A card is managed |
card.expiring_soon, card.expired | A card approaches or reaches its expiry |
product.paused, product.resumed | A product is paused or resumed |
Each delivery is a POST with this body:
{
"id": "1d6b9f3e-4a2c-4e7b-8f15-c3a0d2e6b984",
"type": "card.issued",
"created_at": "2026-11-03T15:59:26.765Z",
"data": { "card_id": "9b2e6f14-7c3a-4d81-b5e0-4a6c2d8f1e37", "card_product_id": "7a9e4c12-5b3d-4f8e-a6c1-2d9b0e7f4c35", "amount": 2000, "currency": "EUR", "expires_at": null }
}Verify deliveries
Each delivery has a gg-signature header of the form t=TIMESTAMP,v1=SIGNATURE. To verify it, compute HMAC-SHA256 of the timestamp, a full stop and the raw body, keyed with the subscription secret, and compare it in constant time with v1.
import { createHmac, timingSafeEqual } from 'node:crypto';
export function verifyWebhook(rawBody, header, secret, toleranceSeconds = 300) {
const parts = Object.fromEntries(header.split(',').map((part) => part.split('=')));
const expected = createHmac('sha256', secret).update(`${parts.t}.${rawBody}`).digest();
const received = Buffer.from(parts.v1 ?? '', 'hex');
const fresh = Math.abs(Date.now() / 1000 - Number(parts.t)) <= toleranceSeconds;
return fresh && received.length === expected.length && timingSafeEqual(expected, received);
}Delivery and retries
- Respond with any
2xxstatus to acknowledge a delivery. - Failed deliveries are retried after about 1 minute, 5 minutes, 30 minutes and 2 hours, then every 6 hours, for up to 72 hours.
- Delivery is at least once, so the same event can arrive more than once. Use the event
idto ignore repeats. - A subscription is disabled after 10 deliveries in a row fail for the full 72 hours.
GET /v1/events lists recent events, so you can catch up after downtime.
Conventions
How the Globagift API handles amounts, idempotent retries, errors, pagination, timestamps and rate limits.
Distributor marketplace
Use the Globagift distributor API to list the merchants you may sell for, show their gift card products, reserve prefunded float, issue cards and reconcile from statements.