Table of Contents

Gift Cards (aka Gift Certificates) in Foxy

How Gift Cards Work

Gift cards are similar to coupons in a few ways. Just as a “coupon” in Foxy defines the coupon itself, and the “coupon code” is the important bit that's entered by the customer, gift cards similarly have “gift card codes” that are the individual resource the customer enters onto the checkout. Unlike coupon codes, however, gift card codes can have balances, allowing them to be reused until the balance is reduced to zero. Also, unlike coupon codes, gift cards will apply to shipping costs.

Though Foxy provides a number of ways to restrict and limit gift cards, most merchants will not use any restrictions. Further, though Foxy allows setting expiration dates, “normal” gift cards in most countries/states/provinces/regions cannot legally be expired. If you plan on using some of the functionality allowing you to restrict gift cards, be sure to check the laws for the locations you sell into.

Selling & Automatically Provisioning Gift Cards

Creating a gift card

Gift cards can be created using the Foxy administration (note that support is not available via the legacy administration) within the “Gift Cards” section. It is also possible to create them via the API for more advanced integrations.

Allowing customers to purchase gift cards

You can also allow customers to purchase gift cards through your store, and have the generated gift card code sent to the recipient automatically.

In the admin, when editing the gift card you want to allow customers to purchase, check the checkbox to “Allow customers to buy this gift card”. This will show you additional options for specifying the gift cards SKU (this will be used within your add to cart later), as well as setting the minimum and maximum amount that a customer can elect to purchase as a balance on the gift card (note that if you specify one of the minimum or maximum's, you need to specify both)

When setting up the product, you can use an existing category for your gift card or create a new category. You’ll need to pass this category with the add-to-cart, and when this product is purchased, Foxy will use the email template that you set up to notify the gift recipient at the specified gift recipient email address with a newly-generated gift card code.

Configure category email

When gift cards are provisioned for a customer, an email is sent to the recipient email specified with the product. You will need to configure this email in one of the categories on your store - using this category as part of your add to cart.

It is up to you whether you create a new Foxy category specifically for your gift cards, or just use an existing category like the Default category.

Create email template

First, if you haven't already, you will create the gift card email template:

  1. In the Foxy admin, navigate to Settings > Emails, and within the “Templates” section, select “Add Template”.
  2. In the popup that appears, give the template a description like “Gift Card Email” (this is just an internal identifier for you), and select the “Send this email” option if it's not already selected. Then, give it a “Subject” like “A gift card, just for you!” - this will be the email subject that the gift recipient will see.
  3. You can leave the rest of the settings as default to use our default email template (pictured below), or you can see some further details on customising the template if desired on this page.
  4. Click “Create” to save the new email template.

Update Foxy categories

Once you have the email template created - head over to the “Categories” section of the administration, and edit each of the categories that you will be using for your gift card products. At the bottom of the settings, you'll see an “Emails” section. For the “Message to the gift recipient” option, select the gift card template you created above.

Note that if you're selling gift cards, you likely will not want to capture a shipping address from the customer. You can do this by setting the “Delivery Type” under “Delivery Options” to “Not shipped”.

Creating the gift card product

To allow customers to purchase the gift card, you will need to create an add to cart form on your own website. It will work just like a normal product add to cart, but with the following required inputs:

Here is an example of an add to cart form:

<form method="POST" action="https://YOURSTORE.foxycart.com/cart">
  <input type="hidden" name="name" value="Widgets Gift Card">
  <input type="hidden" name="code" value="gift_card_widgets">
  <input type="hidden" name="category" value="your-gift-card-category">
  <label>Gift Card Recipient Email: <input type="text" name="gift_recipient_email"></label>
  <label>Gift Card Recipient Message: <input type="text" name="gift_recipient_message" value="" placeholder="Enter a custom message for your recipient"></label>
  <label>Gift Card Amount: <input type="number" name="price" value="10"></label>
  <input type="submit" value="Add Gift Card to Cart">
</form>
  • The gift_recipient_email submitted by the customer must be a valid email address.
  • If you're using the DEFAULT category for your gift card email, you don't need to pass a category.
  • Optionally, you can also pass in gift_recipient_message to show on the default gift card email to the gift recipient.

Set gift card versus customer specified balance

When selling a gift card - you may want to only offer specific balance options, allow the customer to specify their own balance, or a combination of the both.

To offer set amounts, in your add to cart form, you can simply specify the price input as a hidden input, or as a set of radio inputs with specific amounts. The price will then be set at the value you specify in the price input and the customer won't be able to change it.

If you want to allow the customer to specify their own amounts though, you can add the price input as a text input in your form (like in the example above). The customer will then be able to specify any value they want, although they will be limited by any minimum or maximum amount you specified when creating the coupon and enabling the ability for customers to purchase codes.

Note that if a customer attempts to add a gift card to their cart that is below the minimum or above the maximum amount, the add to cart will fail and an error message will be shown noting that the gift card balance is outside the allowed amount.

Creating a gift card via the API

When creating a gift card via the API, you'll add an additional 'provisioning_config object if you want to allow the customer to purchase this gift card:

{
    "name": "Widgets Gift Card",
    "provisioning_config": {
        "allow_autoprovisioning": true,
        "initial_balance_max": 100,
        "initial_balance_min": 10
    },
    "sku": "widgets"
}

The allow_autoprovisioning can be set to false to disallow new gift cards from being purchased by customers. The initial_balance values allow you to set minimum and maximum values for gift cards that are added to the cart, to prevent values outside of a desired range.

Setting up the notification email via the API

Currently, to set up the notification email to the gift recipient, you'll need to create a new email template for the store by POSTing to the Foxy API's email_templates resource. At minimum, you'll need to include the email template description and subject. For example:

{
  "description": "Gift Card Template",
  "subject": "You have a gift!"
 }

The API will return the email template number, for example:

https://.../email_templates/87992

You will then associate the email with the category by sending a PATCH request with the API to the item_categories resource, specifying the correct category number. You should update the gift_recipient_email_template_uri value on this resource to the URL of the new email template that was created above.

{
  "gift_recipient_email_template_uri": "https://api.foxycart.com/email_templates/{{your_new_email_template_id}}"
}

Notes & Considerations

Gift Card UI

Gift cards can only be viewed, created, modified, etc., via the new Foxy admin at admin.foxy.io, or via the API. Support will not be added to the old admin.

How Gift Cards are Attached to Customers

When a customer uses a gift card code (or on creation, if desired) and does not check out as a guest, that gift card code will be attached to the customer record. After that point, only that customer will be able to use the gift card code at checkout. If a different customer attempts to use that gift card code, the customer will see an error.

Note also that gift card codes can be attached to customers via the API.

Gift card codes that are attached to a customer will automatically be applied when that customer logs in on the checkout.

Coming soon: Customers will be able to attach a gift card to their customer account from the customer portal.

Accounting Considerations for Cash v. Accrual Based Bookkeeping

Before you start selling gift cards, you'll likely want to chat with your accountant to ensure you're not setting yourself up for headaches. If you sell a $100 gift card, you get $100 now, but you'll generally also have a $100 liability to account for. Just make sure you know what you're getting into so you can avoid problems.

Multiple Currencies

A gift card in one currency cannot be used if the cart is in a different currency.

Gift Cards & Subscriptions

If a gift card is applied to a subscription, the gift card will continue to apply to the subscription until its balance has been completed used up. The gift card will remain attached to the subscription, but will just not apply any discount. This means that if further balance is added to the gift card, it would start applying additional discounts to the subscription at the next renewal.

Note that even if the gift card reduces the cost of the subscription to $0, the customer will still need to provide a payment method on the checkout. Then, once the gift card balance is exhausted, the customers saved payment method will begin being charged for the subscription renewal.

Taxes, Shipping, and Product Restrictions

If you set a product or category restriction on the gift card, but the transaction contains items that are not covered by the discount, taxes and shipping will still be discounted using the gift card balance.

For instance, let's say you have a $30 Shirt and $30 Pants in the cart, $6 taxes, and $10 shipping. The customer applies a $100 gift card that only applies to Shirts. The discount applied would be $46.

If you have a use case where this causes a problem and where coupons wouldn't make more sense, please do reach out to let us know about it.