Skip to main content

Overview

Spree provides two stored value mechanisms that customers can use at checkout:
  • Store Credits - Value assigned directly to a customer’s account by admins (refunds, loyalty rewards, compensation)
  • Gift Cards - Value with a redeemable code that can be shared and redeemed by anyone

Store Credits

Store Credits are monetary values assigned directly to a customer’s account. They are commonly used for:
  • Refunds (instead of returning money to original payment method)
  • Loyalty rewards
  • Customer compensation
  • Promotional credits

Store Credit Model

Store Credit Attributes

Store Credit Categories

Categories help organize store credits by their purpose:
“Gift Card” is not a seeded category but a special name recognized by the model: any category named “Gift Card” (or one listed in Spree::Config[:non_expiring_credit_types]) is treated as non-expiring via StoreCreditCategory#non_expiring?.

Store Credit Types

Types define the priority in which store credits are applied at checkout:

Store Credit Events

Every action on a store credit is recorded as an event for audit purposes:

Assigning Store Credits

Store credits are managed in the Admin Panel:
  1. Navigate to Customers in the Admin Panel
  2. Select a customer
  3. Go to the Store Credits tab
  4. Click Add Store Credit
  5. Enter the amount, category, and optional memo
  6. Click Create
Store credits can also be created via the Admin API, as a nested resource under the customer:

Store Credit Events

The store credit system publishes lifecycle events:

Gift Cards

Gift Cards are stored value codes created by admins that can be shared and redeemed by customers. When redeemed, they create a Store Credit on the customer’s account.

Gift Card Model

Gift Card Attributes

Gift Card States

Gift cards can also be expired if expires_at date has passed and the card hasn’t been fully redeemed.

Gift Card Lifecycle

Creating Gift Cards

Single Gift Card

  1. Navigate to Gift Cards in the Admin Panel
  2. Click Create Gift Card
  3. Enter the amount and optional expiration date
  4. Click Create
  5. Share the generated code with the recipient
Gift cards can also be created via the Admin API. The code is generated automatically if you don’t supply one:

Batch Gift Card Generation

For promotions or bulk distribution, you can create multiple gift cards at once using Gift Card Batches:
  1. Navigate to Gift Cards in the Admin Panel
  2. Click Create Batch
  3. Enter:
    • Prefix - Code prefix for easy identification (e.g., HOLIDAY)
    • Count - Number of cards to generate
    • Amount - Value per card
    • Expiration - Optional expiration date
  4. Click Create
Batches can also be created via the Admin API:
Large batches are processed in the background to avoid timeout issues.

Redeeming Gift Cards

Gift cards can be redeemed by both registered customers and guest visitors at checkout. This is a key difference from Store Credits, which require a customer account.
Unlike Store Credits which are tied to a customer account, Gift Cards can be applied directly to an order during checkout - no account required. This makes them ideal for gifting to anyone.
When a gift card is applied to an order:
  • The gift card value is used to pay for the order
  • The gift card is marked as redeemed (or partially redeemed)
  • No Store Credit is created for guest checkouts
Gift cards are applied via a dedicated POST /api/v3/store/carts/:cart_id/gift_cards endpoint (separate from the discount_codes endpoint used for promotion codes); the discount-codes endpoint does not handle gift cards. See the cart & checkout SDK guide for the full cart flow these calls belong to.

Gift Card Events

The gift card system publishes lifecycle events:

Using at Checkout

Store Credits and Gift Cards work differently at checkout:
  • Store Credits - Require a customer account; applied from the customer’s balance
  • Gift Cards - Can be used by anyone (guests included); applied directly to the order via code

Checkout Flow

Store Credit Priority

When a registered customer has multiple store credits, they are applied in order of priority:
  1. Expiring credits - Applied first to ensure they’re used before expiration
  2. Non-expiring credits - Applied after expiring credits