Gift Card products and purchases

Integrate catalog discovery, recipient selection, cart identity, paid-order delivery, the Gift Card page and My Gift Cards.

Products are not issued cards#

A Gift Card product is a catalog listing; an issued card holds a redeemable balance. Use Store API GET /api/2025-01/gift-cards/products with read_products and read_gift_cards, or filter GET /api/2025-01/products with is_gift_card=true. The normal product list includes both classifications. Product create uses POST /api/2025-01/gift-cards/products with write_products and write_gift_cards. Updates and deletion use /products/{id} and require both write scopes for Gift Card products. Publishing requires active status and an explicit sales-channel assignment; creating a product does not insert menu links or issue a card.

One public classification for every integration#

Hosted product and product-card CTX expose is_gift_card. The browser bridge exposes product_is_gift_card in its product-page context. An app surface can declare product.is_gift_card to receive product_is_gift_card in its scoped context. This is the same public catalog fact for every app: it grants no extra permissions and does not replace an app’s compatibility decisions. Gift Card products keep their simple or variable product type. Do not confuse is_gift_card with gift_only, which identifies free-gift promotional inventory.

Recipient input#

Recipient details control delivery; they do not restrict who can redeem the card. Anyone with the code can use it. Checkout does not match the recipient email or customer when redeeming a code. Omit gift_card_recipient (or supply null) to deliver to the purchaser’s checkout contact. To send to someone else, provide an object with name, email, phone, message and optional deliver_at (RFC 3339). Supply a valid email or an international phone number beginning with +. If both are present, purchase delivery uses email. The delivery route must be configured before an order can be placed: payment is refused with GIFT_CARD_DELIVERY_UNAVAILABLE when the store cannot deliver by the recipient's email or phone. Themes learn this up front from ctx.forms.cart_add.gift_card_recipient_email.available and ctx.forms.cart_add.gift_card_recipient_phone.available (the same in ctx.forms.buy_now): offer only the fields that are available, and no send-as-gift option when neither is. A schedule must be in the future. The server rejects amount, currency, expiry-policy and other undeclared fields; purchase value always comes from authoritative catalog pricing.

The browser methods tringify.cart.add and tringify.checkout.buyNow accept gift_card_recipient alongside product_id, variant_id and quantity. For example: tringify.cart.add({product_id: 7, quantity: 1, gift_card_recipient: {name: "Avery", email: "avery@example.com", message: "Enjoy your gift"}}). Use the normal hosted action response and display its localized message; do not translate backend error codes in the client.

Hosted cart_add and buy_now forms accept gift_card_recipient as one JSON field. Native HTML controls can instead submit gift_card_send_as_gift=true with gift_card_recipient_name, gift_card_recipient_email, gift_card_recipient_phone, gift_card_recipient_message and gift_card_deliver_at; the recipient fields are read only when gift_card_send_as_gift is true. Send gift_card_deliver_at as RFC 3339 with an offset: a bare datetime-local value is read as UTC, so convert the shopper's local time in the browser (or label the field as UTC). ctx.forms.cart_add and ctx.forms.buy_now give each recipient field's max_length; bind inputs to them instead of writing numbers. Their gift_card_recipient_email.available and gift_card_recipient_phone.available are true when the store can deliver a card by email (an active Gift Card delivery email template and a ready sender) or by text message (the Gift Card delivery message sends on SMS or WhatsApp) now; they are worked out only when a template reads them, once per request. Pages that read them stay cached at the edge: a change to the store's Gift Card delivery email template, its email sender or its Gift Card text message route refreshes them. The same fields are preserved when the submitter uses purchase_intent=buy_now. Themes control presentation and must expose recipient controls themselves; existing custom themes are not silently rewritten. What to build, the checks and the strings to ship: Gift Cards in your theme.

html
{% if product.is_gift_card %}{% if forms.cart_add.gift_card_recipient_email.available or forms.cart_add.gift_card_recipient_phone.available %}
  <label><input type="checkbox" name="gift_card_send_as_gift" value="true"> {{ 'products.gift_send' | t }}</label>
  <label>{{ 'products.gift_name' | t }} <input name="gift_card_recipient_name" maxlength="{{ forms.cart_add.gift_card_recipient_name.max_length }}" autocomplete="off"></label>
  {% if forms.cart_add.gift_card_recipient_email.available %}<label>{{ 'products.gift_email' | t }} <input type="email" name="gift_card_recipient_email" autocomplete="off"></label>{% endif %}
  {% if forms.cart_add.gift_card_recipient_phone.available %}<label>{{ 'products.gift_phone' | t }} <input type="tel" name="gift_card_recipient_phone" autocomplete="off"></label>{% endif %}
  <label>{{ 'products.gift_message' | t }} <textarea name="gift_card_recipient_message" maxlength="{{ forms.cart_add.gift_card_recipient_message.max_length }}"></textarea></label>
  <label>{{ 'products.gift_date' | t }} <input type="datetime-local" data-gift-local></label>  {# no name: script writes the offset value below #}
  <input type="hidden" name="gift_card_deliver_at">
{% endif %}{% endif %}

Hosted cart.items exposes gift_card_recipient with snake_case fields: name, email, phone (E.164) and phone_display (international format, for showing), message, deliver_at (RFC 3339 store time) and deliver_at_display (store time with the store's timezone named, in the shopper's language, such as "Fri, Oct 30, 9:00 AM (Hong Kong Time)"; null when no schedule was chosen). Themes print phone_display and deliver_at_display and never format the time themselves. App surface cart.add_lines and checkout.buy_now accept the same recipient object on each line, under their existing declared actions. No additional app authority is granted.

Identity, payment and editing safety#

Recipient details are part of line identity, not ordinary line properties or analytics. Different recipients or messages create different lines; increasing quantity buys multiple cards for that same recipient. Always pass the returned line_id/lineId when updating or removing a recipient-specific line. To change its recipient, remove that line and add the replacement. Login cart merging and Buy Now retries retain the selection. Reuse the same mutation ID only for an identical request.

Order creation snapshots the purchase amount, currency, recipient and current expiry policy. Cards are issued idempotently only for a paid, non-test purchase; imported historical orders do not issue new stored value. Delivery may be immediate or scheduled. A provider-submitted status is not a delivery receipt. Catalog changes do not rewrite an order or an already-issued card.

Product detail exposes gift_card_policy.can_edit_value, can_delete and a localized reason. Once any order references a Gift Card product, including an unpaid order, financial fields cannot be edited and the product cannot be deleted (GIFT_CARD_PRODUCT_LOCKED). Archive or unpublish it and create a replacement for another value. Title, description, media, SEO, organization and publication remain editable. Physical inventory, shipping, tax classes, sale prices, quantity discounts and free-gift controls are rejected (GIFT_CARD_PRODUCT_CONTROLS_INVALID). These rules apply equally to Store Admin, mobile, imports and apps.

Catalog changes use the existing products/create, products/update, products/delete and publication webhook topics, carrying is_gift_card where a product object is present. Issued-card lifecycle events remain separate Gift Card topics. Public catalog data and analytics never expose redeemable codes, code hashes or delivery secrets; CTX carries a full code only on the Gift Card view page and in My Gift Cards, described below.

Gift Card page#

The platform owns the Gift Card page, as it owns the account pages: GET /gift-cards checks a balance, and GET /gift-cards/view/{token} opens one card from the View your gift card link in the Gift Card Delivery email or text message. Both work under the store's locale prefixes (for example /fr-ca/gift-cards), are marked noindex and are never served from the storefront HTML cache. Both return the store's 404 page when the merchant turns off balance_check_enabled in the Gift Card settings. The theme renders both with its gift_card template and the section its surface rules require there (Canvas: main-gift-card); see Gift Cards in your theme.

ctx.gift_card is null until a lookup succeeds in the same request. A lookup posts the gift_card_lookup hosted action with code (trimmed, case-insensitive, hyphens optional; ctx.forms.gift_card.code gives required and max_length). The platform adds its proof-of-work script to the gift_card page, so a plain form submits correctly; a submission without a solved challenge is refused, and lookups are rate limited per visitor and per store. A successful lookup re-renders the template with ctx.gift_card, where code is null and code_masked (such as •••• 4F7K) is the only form of the code. A failed lookup, and a view link that is unknown or belongs to a cancelled card, render the template with ctx.gift_card null and one generic message in ctx.form_error: print it as given and do not try to tell the cases apart. On the view route code is the full code and message is the sender's message.

balance and initial_value are presented money: print their formatted value. status is active, used, expired, disabled or cancelled, and status_label is its wording in the storefront language. expires_at is RFC 3339 in the store's timezone with its offset, or null; expires_at_label is ready-to-print text with the time and the store's timezone, such as "Valid until Fri, Dec 31, 2027, 11:59 PM (Hong Kong Time)", or null. shop_url links back to the store. Never print code where it is null, and never put a code in a URL, analytics event or console output.

html
{% if form_error and form_error.message != blank %}
  <p role="alert">{{ form_error.message }}</p>
{% endif %}
{% form 'gift_card_lookup' %}
  <label>{{ 'gift_card.code' | t }}
    <input name="code" autocomplete="off" required maxlength="{{ forms.gift_card.code.max_length }}">
  </label>
  <button type="submit">{{ 'gift_card.check' | t }}</button>
{% endform %}
{% if gift_card %}
  <p>{% if gift_card.code %}{{ gift_card.code }}{% else %}{{ gift_card.code_masked }}{% endif %}</p>
  <p>{{ gift_card.balance.formatted }} · {{ gift_card.status_label }}</p>
  {% if gift_card.expires_at_label %}<p>{{ gift_card.expires_at_label }}</p>{% endif %}
  {% if gift_card.message %}<blockquote>{{ gift_card.message }}</blockquote>{% endif %}
{% endif %}

My Gift Cards#

In the account template, a section that declares the ctx need customer.gift_cards receives ctx.customer.gift_cards: items, page_size, next_url, first_url and active. Items are newest first, page_size (20) per page. Pages use a cursor, so print next_url and first_url as given; next_url is empty on the last page. active is true when the shopper paged into the list: open your Gift Cards tab or panel then, as account themes do for orders.

kind is received or sent, and kind_label its wording. initial_value is present on both. A received card is one sent to an email address or phone number the shopper confirmed (once it is no longer scheduled), or one the shopper bought that was sent to their own account email or phone. It carries code, code_masked, balance, status, status_label, expires_at and expires_at_label; code is null when the full code isn't available, such as for a cancelled card, so show code_masked then. A sent card is one the shopper bought for someone else. It carries recipient_name, delivery_status (scheduled, sending, sent or not_sent), delivery_status_label, sent_at and scheduled_at (RFC 3339 in the store's timezone, or null), and sent_at_display and scheduled_at_display, the same times ready to show with the store's timezone named (print these). sent means the card was handed off for delivery; the store does not track whether it reached the recipient, so never word it as delivered. not_sent means it could not be sent; its code, code_masked, balance and status fields are null, and a theme must not try to show them.