Coupons
Charge support coupons for single use and recurring payments. They can be a fixed amount discount, or a percentage of the total. To make use of coupons, you'll first setup a Coupon in the Charge CP, then add the coupon field to your payment form, and finally add extra output to your thanks and receipt templates.. In the Charge CP, to to the 'Coupons' page. You'll see a form with the following options :
Coupon Options
In the CP, you'll see a form like this :
Coupon details are broken into 3 main parts - Basic Details, Coupon Type and Payment Type. Depending on the specific options, different settings will be required and displayed on the coupon setup.
Basic Details
Name
- The Name of the coupon. Just a friendly name to identify this coupon.
Code
- The unique code for the coupon. This is the code the customers will enter on the form.
Coupon Type
Coupon Type
- The type of discount this coupon applies. Can be either Fixed Amount or Percentage Off
Amount Off
used with fixed amount coupons- The amount to discount the total. ie. '3.50' == a discount of $3.50
Currency
used with fixed amount coupons- The currency this coupon is valid for use with.
Percentage Off
used with percentage off coupons- The percentage discount to apply. Must be within 1 - 100 range.
Payment Type
Payment Type
- The types of payments this coupon can be used with. Can be One-off or Recurring types
Max Usages
used with recurring payment coupons- The maximum number of times a coupon can be used
Duration
used with recurring payment coupons- The duration this coupon is valid for on a recurring payment for a customer. Can be Once, Forever or Repeating
Duration in Months
recurring payment coupons, with a duration of 'repeating'- The number of months the coupons repeats for
Coupon Input on the Payment Form
With coupons created, in your payment form you now need to add an input for the coupons. This is as simple as adding an input called plan_coupon
and some variables to your form :
..
<label for="plan_coupon">Coupon</label>
<input type="text" name="plan_coupon" id="plan_coupon" value="{plan_coupon}"/>
{if error_plan_coupon}
<span class="error">{error_plan_coupon_message}</span>
{/if}
..
Note: Be sure to include the error_plan_coupon_message output in your form. If the coupon fails validation we'll return an error to the page.
Add Coupon Info to Thanks & Receipt Pages
Finally, you'll want to make sure the applied coupon is shown on your thanks and receipt pages. If there has been a coupon applied the plan_amount
will reflect the value paid, and the original payment amount will be available as plan_full_amount
. Also the discount amount is available as {plan_discount}.
For full reference, the coupon specific variables avaiable in the {exp:charge:info}
tag are :
{plan_amount}
- The actual amount paid.
{plan_discount}
- The amount discounted
{plan_full_amount}
- The full amount for the payment, before discounts
{plan_coupon}
- The coupon code applied (if any)
{plan_coupon_stripe_id}
- The stripe id for the coupon applied. Only valid for recurring payment coupons