AddThisFeature

Gift Cards

Sell gift cards that arrive on time and redeem cleanly against a real order total.

involved Monetization

What it adds

Purchasable gift cards with a delivered code, a tracked balance, and redemption applied at checkout alongside other payment.

What your agent is told to do

5
  1. 1

    Treat a gift card as a balance with an immutable ledger of transactions, not a mutable number. Issue, redeem, refund, and expire are all entries; the balance is their sum, which makes every discrepancy traceable.

  2. 2

    Generate codes that cannot be guessed or enumerated, store only a hash of the code, and show the full code once at purchase and in the delivery email. A recoverable code is a recoverable bearer instrument.

  3. 3

    Apply a card at checkout as payment, not as a discount. It reduces the amount due after tax and shipping are calculated, and the remainder goes to the card or wallet on file.

  4. 4

    If the app already has Credit Balance or Coupon and Promotion Codes, extend the balance ledger and the checkout payment step rather than adding a parallel one. A gift card is a funded balance; a promotion code is a price rule, and conflating them breaks refunds.

  5. 5

    Do not let redemption be validated on the client. Every application of a card must be a server-side operation that locks the card row, checks the balance, and records the entry atomically.

Edge cases it handles

8
  • Two checkouts using the same card at once must not both succeed against the same funds. Serialise redemptions on the card record and make the balance check and the ledger write a single atomic operation so the balance can never go negative.
  • A card rarely covers the whole order. Support partial redemption where the card supplies what it has and the remainder is charged to a payment method, and make the split visible on the order and the receipt.
  • Refunding an order paid partly by gift card must return the card portion to the card and the charged portion to the payment method. Refunding the whole amount to the card, or to the card holder's payment method, quietly creates or destroys money.
  • Delivery can be scheduled for a future date, which means the send can fail long after the buyer has gone. Handle a bounced or rejected recipient address by notifying the buyer with the code so the gift is not simply lost.
  • Expiry and dormancy rules differ by jurisdiction and in several places gift card funds may not expire at all. Make expiry configurable rather than hardcoded, keep the balance recoverable after the nominal expiry date, and record which rule applied.
  • A card bought and then refunded before delivery must be voided, and a code that has already been sent must be handled as compromised rather than reissued to the same recipient.
  • Repeated code entry attempts must be rate limited. Without it, the checkout field is a brute-force oracle against every card you have ever issued.
  • The recipient may not have an account. Redemption must work for a guest checkout and must not require registration to spend a balance someone already paid for.

Definition of done

9
  • Every issue, redemption, refund, and adjustment appears as a ledger entry and the balance is their sum.
  • Concurrent redemptions cannot take the balance below zero.
  • A partial redemption charges the remainder to a payment method and shows the split on the order.
  • Refunds return the gift card portion to the card and the charged portion to the original payment method.
  • Scheduled delivery sends on the chosen date and a bounce notifies the buyer with the code.
  • Codes are stored hashed, rate limited on entry, and unguessable.
  • Expiry rules are configurable and the balance is not silently destroyed.
  • The feature matches the existing design system.
  • No existing functionality is broken.

Related features

How it works

  1. 1

    Copy the link

    Grab the Markdown instruction URL for this feature.

  2. 2

    Give it to your AI

    Paste it into Claude Code, Cursor, v0, Lovable — whatever you build with.

  3. 3

    It inspects, then implements

    Your agent reads your existing app first, then adds the feature to fit it.

Works with your stack

These instructions are written to adapt. They tell the agent to detect your framework, match your existing design system, and reuse what you already have — rather than assuming a particular stack.

Need it tighter than that? Customize the feature and tell it exactly what you're running.