Modeling gift cards.

By Filippo Conforti on July 25, 2023

Gift cards are simple, yet powerful payment instruments that can unlock interesting business flows (think of buying a gift card in store and redeem it online, or vice versa) and boost sales.

Depending on the use case, a gift card can be viewed as a digital product, a payment method, a digital wallet, a promotion, or a combination of these. In fact, gift cards can be sold, used to pay (or partially pay) for an order, reloaded, and, of course, sent as gifts. Occasionally, merchants can use gift cards to give their customers store credits, such as as an alternative refund method or as a promotional strategy.

The purpose of this article is to describe a possible gift card model and some best practices for selling and redeeming gift cards online and in your brick and mortar store. The model is based on how Commerce Layer handles gift cards. Please refer to the API documentation here for more information.

The gift card model

Below is a list of attributes that can be used to model a gift card. A brief description explains the main functionality of each attribute.

Using the "status" attribute, the gift card is modelled as a state machine. Gift cards are created in “draft” mode. When the gift card is in this status, you can edit all the other attributes without affecting the balance or triggering other actions.

Before the gift card can be redeemed, it must be activated. A physical gift card purchased in store, for example, should not be activated right away, but rather through an online process. The same can be said if you send a gift card to a friend via an online purchase that must be activated when received.

When the gift card becomes active, it can be redeemed. The gift card can be deactivated at any time, changing its status to "inactive". In the event that the gift card is not redeemed before the expiration date, it will become invalid and no longer be redeemable. Below is a state machine diagram showing all possible transitions.

An example of a state machine modeling a gift card.
An example of a state machine modeling a gift card.

Selling gift cards

Gift cards may be sold as a digital good, emailed to the customer, or as a physical good, printed and shipped to the customer after an online purchase. There is no inventory in either case, since you can virtually print as many gift cards as you like. In store, gift cards will be pre-printed. According to the merchant's policy, customers can pick them from the shelves and use them online or in-store.

Generally, gift cards come in a variety of sizes. Our model lets you set the gift card size by setting the initial balance and currency. Additionally, you can set the gift card to be used only once, in which case it would function as more of a voucher. Rechargeable gift cards allow customers to add credit to their balance. A balance log will keep track of any credit. Lastly, you can set an expiration date for the gift card. A gift card that has expired can no longer be redeemed. As a result, the gift card would appear more like a promotion. Setting an expiration date also adds an extra layer of security that never hurts.

Redeeming gift cards

You can use a gift card to pay—or partially pay—for an order during checkout. Customers are typically asked to insert the gift card code, which must be unique and hard to guess, but not too difficult to enter. The use of UUIDs as gift card codes can be a good option. For practical purposes, UUIDs are unique. Instead, they are quite long to type and customers can be stuck with typos at checkout. This is why you may want to request only the first N digits of the UUID. Depending on whether no gift cards are found or only one gift card with the first N digits, you can either reject or accept the code. Otherwise, if a conflict occurs, you can ask the customer to enter the entire code.

Whenever the gift card balance does not cover the entire amount due, the customer should be able to pay with one of the payment methods provided by your platform. If this is the case, the gift card becomes merely a line item with negative value, thereby reducing the order total.

Gift cards and coupons

There may be times when you want to offer the option of redeeming gift cards and coupons at the same time. In spite of the fact that gift cards and coupons are very different, they share some characteristics that can be taken into account from a UX perspective. For instance, both are redeemed using codes. Having two fields at checkout, one for coupons and one for gift cards, can be confusing for customers. Furthermore, it would make the checkout form too crowded. That is why exposing a single field that allows the customer to enter a gift card or coupon code can be a good idea. At runtime, your backend code or API will be responsible for finding and validating the right information.

Enjoy the reading?

Subscribe to the newsletter and get a new article delivered to your inbox every week.