Documentation You are here: start » v » 2.0 » gift_cards

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
v:2.0:gift_cards [2024/11/11 13:56] – [Provisioning the gift card] adamv:2.0:gift_cards [2024/11/12 15:57] (current) – [Creating the gift card product] adam
Line 16: Line 16:
 You can also allow customers to purchase gift cards through your store, and have the generated gift card code sent to the recipient automatically. 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 (leave these as 0 to specify no minimum and/or maximum)+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. 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 =====+{{ :undefined:gift_card_provisioning.png?direct&600 |}} 
 + 
 +=== 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. 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.
Line 26: Line 28:
 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. 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 ======+=== Create email template ===
 First, if you haven't already, you will create the gift card 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"+  - In the Foxy admin, navigate to Settings > Emails, and within the "Templates" section, select "Add Template"
-1. 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. +  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. 
-1. 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. +  You can leave the rest of the settings as default to use our default email template (pictured below), or you can [[https://wiki.foxycart.com/v/2.0/gift_cards/email_template|see some further details on customising the template if desired on this page]]
-1. Click "Create" to save the new email template.+  Click "Create" to save the new email template.
  
 +{{ :undefined:gift_card_email.png?direct&600 |}}
  
-{{:v:2.0:gift_cards_provisioning.png?400|}}+{{ :v:2.0:gift_card_email_template.png?direct&600 |}}
  
-====== Update Foxy categories ======+=== 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. 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". 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".
 +
 +{{ :undefined:gift_card_category.png?direct&600 |}}
 +==== 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 [[v:2.0:products:|a normal product add to cart]], but with the following required inputs: 
 +  * ''name'': The name of your product
 +  * ''price'': The amount that will be put onto the gift card (you can set this as a text input to allow the customer to enter their own amount)
 +  * ''code'': The code of the product, set to the SKU you defined on the gift card, but with a prefix of ''gift_card_''. So for example, if you gave the gift card a sku of ''widgets'' as in the example above, the code would be ''gift_card_widgets''
 +  * ''gift_recipient_email'': The email of the recipient of the gift card, this would work best as a text input to allow the customer to enter the email.
 +  * ''category'': The category associated with the gift card. This is optional if you're using the ''DEFAULT'' category, but should be set to whichever category you have defined the gift card email for. for the gift card.
 +  * ''gift_recipient_message'': //Optional//. If specified, it will be passed through with the email as an additional message. This would work best as a text input to allow the customer to enter a custom message.
 +
 +Here is an example of an add to cart form:
 + <code html>
 +<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>
 +</code>
 +
 +<WRAP center round tip 90%>
 +  * 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.
 +</WRAP>
 +
 +=== 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.
 +
 +<WRAP center round important 90%>
 +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.
 +</WRAP>
 +
  
 ===== Creating a gift card via the API ===== ===== Creating a gift card via the API =====
Line 59: Line 104:
  
 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. 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.
-==== Creating the gift card product ==== 
-You will create a gift card add-to-cart link or form on your own website using the [[v:2.0:products:|product creation guidelines]] with the following required inputs: ''name'', ''price'', ''gift_recipient_email'', ''category'' for the gift card, and code that matches ''gift_card_'' plus the sku from the gift card. So, if you gave the gift card a sku of ''widgets'' as in the example above, the code would be ''gift_card_widgets''. 
  
-Here is an example of a product form: +==== Setting up the notification email via the API ====
- <code> +
-<form method="POST" action="https://your-foxy-store-url/cart"> +
-  <input type="hidden" name="name" value="Widgets Gift Card" /> +
-  <input type="hidden" name="code" value="gift_card_widgets" /> +
-  <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="Here's a gift card for you!" /></label> +
-  <label>Gift Card Amount<input type="number" name="price" value="10" /></label> +
-  <input type="hidden" name="category" value="your-gift-card-category" /> +
-  <input type="submit" value="Add Gift Card to Cart" /> +
-</form> +
-</code> +
- +
-The matching code in the example above will result in the product showing in the cart with a product name of "Widgets Gift Card"+
- +
-<note tip> +
-  * 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. +
-</note> +
- +
-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. +
- +
-See the following section for setting up the gift card email.  +
- +
-==== Setting up the notification email ==== +
- +
-<note>These steps can now be done in the new Foxy administration. You'll select to send the gift card email when you set up the category that you will use for the gift card.</note>+
  
 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: 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:
Line 95: Line 111:
 <code json> <code json>
 { {
-  "description": "Gift Card Recipient Template",+  "description": "Gift Card Template",
   "subject": "You have a gift!"   "subject": "You have a gift!"
  }  }
Line 112: Line 128:
 } }
 </code> </code>
- 
-<note tip>For tips on customizing the gift card email, you can see our article here: [[v:2.0:gift_cards:email_template|Customizing the Gift Card Email]]</note> 
 ===== Notes & Considerations ===== ===== Notes & Considerations =====
  

Site Tools