GiftWeb Voucher API

Buy gift vouchers automatically from your own website, app or billing system. Each API call delivers exactly one voucher and deducts its price from your prepaid wallet.

Base URL
FormatJSON request and response, UTF-8
CurrencyINR. Prices and balances are strings with 2 decimals, e.g. "490.00"
Timesold_at is UTC (YYYY-MM-DD HH:MM:SS)

Authentication

Create an API key in your dashboard under API Keys. The key is shown only once — store it safely. Send it in the X-API-Key header on every request:

X-API-Key: gv_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Server-side only. Never put your API key in browser JavaScript or a mobile app — anyone could extract it and spend your wallet balance. If a key leaks, disable it in the dashboard and create a new one.

Integration flow

  1. Your customer pays you on your website/app.
  2. After payment succeeds, your server calls POST /v1/purchase with the product sku and your own unique order id.
  3. You receive the voucher code (and pin if any) in the response. The price is deducted from your wallet.
  4. Deliver the code to your customer (screen / email / SMS / WhatsApp).
  5. If the call times out or fails with a network error, retry with the same order_id — you'll get the same voucher, never charged twice.

List products

GET/v1/products

Products you can buy, your price and current stock.

{
  "success": true,
  "products": [
    { "sku": "AMAZON-500", "name": "Amazon Pay Gift Card 500", "brand": "Amazon",
      "denomination": 500, "currency": "INR", "price": "490.00", "in_stock": 132 }
  ]
}

Wallet balance

GET/v1/balance
{ "success": true, "wallet_balance": "12450.00", "currency": "INR" }

Buy a voucher

POST/v1/purchase
FieldTypeDescription
skustringrequiredProduct SKU from /v1/products
order_idstringrequiredYour unique order/transaction id (max 100 chars). Used for safe retries.
customer_refstringoptionalYour customer's email / phone / user id, for your records (max 200 chars)

Request

POST /v1/purchase
Content-Type: application/json
X-API-Key: gv_live_xxx

{ "sku": "AMAZON-500", "order_id": "ORD-10045", "customer_ref": "rahul@example.com" }

Response — 201 Created (new purchase) / 200 OK (repeat of same order_id)

{
  "success": true,
  "order_id": "ORD-10045",
  "replayed": false,
  "voucher": {
    "voucher_id": 1841,
    "sku": "AMAZON-500",
    "product_name": "Amazon Pay Gift Card 500",
    "brand": "Amazon",
    "denomination": 500,
    "currency": "INR",
    "code": "AMZ5-QWER-TYUI-0003",
    "pin": "345678",
    "expiry_date": "2027-03-31"
  },
  "price": "490.00",
  "wallet_balance": "11960.00",
  "customer_ref": "rahul@example.com",
  "sold_at": "2026-11-21 06:31:22"
}

pin and expiry_date may be null when the voucher has none. replayed: true means this order_id was already fulfilled and you are seeing the same voucher again (no new charge).

Get an order

GET/v1/orders/{order_id}

Fetch a voucher you already bought, using the same order_id. Returns the same body as a purchase with replayed: true, or 404 ORDER_NOT_FOUND.

Retries & idempotency

Errors

Errors return "success": false with a machine-readable code:

{ "success": false, "error": { "code": "OUT_OF_STOCK", "message": "No vouchers available for AMAZON-500" } }
HTTPcodeMeaning / what to do
400BAD_SKU, BAD_ORDER_ID, BAD_JSONFix the request
401UNAUTHORIZEDMissing, wrong or disabled API key
402INSUFFICIENT_BALANCEWallet balance is lower than the price. Recharge, then retry with the same order_id
403ACCOUNT_DISABLEDYour account is disabled — contact admin
404SKU_NOT_FOUNDUnknown or inactive product
404ORDER_NOT_FOUNDNo voucher for this order_id
409OUT_OF_STOCKNo voucher available now. Nothing was charged — refund your customer or try later
409PRICE_NOT_SETProduct is not on sale yet
409ORDER_ID_REUSEDThis order_id was already used for another SKU
500INTERNALServer error — retry with the same order_id
On any error, no voucher is consumed and no money is deducted.

Code examples

curl -X POST "/v1/purchase" \
  -H "X-API-Key: $VOUCHER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"sku":"AMAZON-500","order_id":"ORD-10045","customer_ref":"rahul@example.com"}'

Security checklist

Need help? Contact your Rivvo account manager.
© Rivvo Digital Services Private Limited. All rights reserved.