Overview
Gift cards are digital payment instruments that enable merchants to:- Create branded gift cards with custom cover designs
- Issue cards with specified amounts and currencies
- Track card status and redemption via the query API
- Query merchant account currency balances (separate from any single card) when needed
API Reference
Create Gift Card
Endpoint:POST /v1/pay/gift/create
Creates a new gift card with specified parameters. Responses use the standard status / code / label / errorMessage / data wrapper. On success, card fields such as card_num, card_key, and numeric status are inside data.
Request Parameters
Response Fields
Responses use the common wrapper:status, code, label, errorMessage, and data. On success, the gift card payload is in data:
Example Request
Example Response
title is not a string, the request is rejected before a gift card is created and no business data is written:
Query Gift Card Cover Templates
Endpoint:GET /v1/pay/gift/temp/list
Retrieves available cover templates for gift card customization.
Response Fields
Successful responses use the common wrapper; templates are returned indata as an array. Each item has:
Example Response
Query merchant account balances
Endpoint:GET /v1/pay/balance
Returns balances for all currencies available on the current merchant account (account-level balances), not a single gift card. There are no query parameters; authentication headers apply as for other Pay APIs.
Response Fields
Example Response
Query Gift Card Details
Endpoint:POST /v1/pay/gift/query
Retrieves gift card details by card number or redemption code. Send a JSON body (not query string). Provide card_number and/or key; if both are sent, key takes priority.
Request body
Response Fields (data)
Example Request
Example Response
Batch query gift cards
Endpoint:POST /v1/pay/gift/batch/query
Returns a paginated list of gift cards created by the current merchant, filtered by batch ID or creation time range. When you provide both batch_id and a time range, the API returns records that match both filters.
Request body
Example request
Response fields (data)
Example response
Gift card status codes
The create and single-card query endpoints returnstatus as an integer. The batch query endpoint returns list[].status as the string form of public status codes 0–8. It does not expose internal extension statuses 9–11; those values are returned as 0:
Callback Behavior
Gift cards do not provide asynchronous callbacks. Retrieve a single card’s status and details withPOST /v1/pay/gift/query, or use POST /v1/pay/gift/batch/query to page through cards by batch or creation time. Use GET /v1/pay/balance when you need the merchant account’s multi-currency balances, not a per-card balance.
For information on callback handling for other products, see Notification & Callbacks.
Error Handling
Common platform error codes and how to resolve them are listed below. When querying a gift card, an incorrect key or card number may return5003000.
For more error codes and best practices, see Error Codes & Best Practices.
Integration Guide
Minimum runnable path
Basic Flow
- Retrieve available templates using
GET /v1/pay/gift/temp/list - Create a gift card using
POST /v1/pay/gift/createwith your chosen template - Store the card details (
card_numandcard_keyfrom the create response) securely - Distribute the gift card to your customer
- Query one card’s details with
POST /v1/pay/gift/query(body:card_numberand/orkey), or page through gift cards withPOST /v1/pay/gift/batch/query. UseGET /v1/pay/balanceonly for merchant account currency balances
Best Practices
- Store both
card_numandcard_keyfor lookups; the query API acceptscard_numberorkeyin the JSON body (if both are sent,keywins) - For batch queries, provide
start_timeandend_timetogether. Whenhas_moreistrue, incrementpageto continue - Use Gift card status codes when branching, and handle the integer or string field type documented for each endpoint
- Use
card_temp_idfrom the template list astemplateIdwhen creating a card GET /v1/pay/balancereflects merchant account funds by currency, not an individual gift card’s remaining value

