Coupons are merchant-facing objects you can use to control discounts on subscriptions or invoices. Promotion codes are customer-facing codes that are created on top of coupons and can be shared directly with your customers.
- Create customer-facing codes that map to a single underlying coupon. For example, FALLPROMO and SPRINGPROMO both pointing to a single 25% off coupon.
- Customize controls and limits on promotion codes by specifying eligible customers, first time orders, minimum order values, expiration dates, and redemption limits
- Limit the products that coupons can be applied to
Creating promotion codes
To create a promotion code, specify an existing
coupon and any restrictions (for example, limiting to a specific
customer). If you have a specific code you’d like to give to your customer (e.g.,
FALL25OFF), set the
code. If you leave this field blank, we’ll generate a random
code for you.
code is case-insensitive and unique across active promotion codes for any customer. For example:
- You can create multiple customer-restricted promotion codes with the same
code, but you can’t reuse that
codefor a promotion code redeemable by any customer.
- If you create a promotion code that is redeemable by any customer, you can’t create another active promotion code with the same
- You can create a promotion code with
code: NEWUSER, inactivate it by passing
active: false, and then create a new promotion code with
Applying promotion codes
When a customer attempts to redeem a code, you’ll first retrieve the promotion code’s ID by retrieving the active promotion code with the entered
Create a discount by applying the
promotion_code[id] to a subscription. You can do this when creating the subscription, as in the following code, or by updating a subscription later. You can also apply the promotion code to a customer when creating or updating the customer.
Adding promotion codes to Checkout
You can also enable promotion codes with the allow_promotion_codes parameter in Checkout Sessions. When
allow_promotion_codes is enabled on a Checkout Session, Checkout includes a promotion code redemption box for your customers to use.
Create your coupons and promotion codes through the Dashboard or API in order for your customers to redeem them in Checkout.
Promotion code configurations
By configuring the promotion code object parameters, you can customize which customers are eligible, how many times a promotion can be redeemed, when a promotion code expires, or set a minimum amount the discount can be applied to.
Limit by customer
To limit a promotion to a particular customer, specify a
customer when creating the promotion code. If no customer is specified, the code can be redeemed by any customer.
Limit by first time order
You can also limit the promotion code to first time customers with the
first_time_transaction parameter of the
restrictions attribute. If the
customer isn’t defined or if a defined
customer has no prior payments or non-void invoices, it is considered a first time transaction.
Set a minimum amount
With promotion codes, you can set a minimum transaction amount for eligible discount by configuring the
minimum_amount and the
minimum_amount_currency properties. Since promotion code restrictions are checked at redemption time, the minimum transaction amount only applies to the initial payment for a subscription.
You can set an expiration date on the promotion code using
expires_at. If the underlying coupon already has
redeem_by set, then the promotion code’s expiration date can’t be later than the coupon’s. If
promotion_code[expires_at] isn’t specified, the coupon’s
redeem_by automatically populates
- For example, you might have plans to support a coupon for a year, but you only want it to be redeemable for one week after a customer receives it. You would set
coupon[redeem_by]to one year from now, and set each
promotion_code[expires_at]to one week after it is created.
You can limit the number of redemptions by using
max_redemptions, which works similarly to coupons. If the underlying coupon already has
max_redemptions set, then the promotion code’s
max_redemptions can’t be greater than the coupon’s.
- For example, you might want a coupon to be redeemable by the first 50 customers, but every customer can only use it once. In this scenario, you would set
You can set whether a promotion code is currently redeemable by using the
active parameter. However, if the underlying coupon for a promotion code becomes invalid, all of its promotion codes become permanently inactive. Similarly, if a promotion code reaches its
expires_at, it becomes permanently inactive. These promotion codes can’t be reactivated.
Coupon code configurations
There are some configurations that can be set in a coupon, and will apply to any promotion codes that map to it. See how to set coupon configurations, like amount off, redemptions, and restrictions by products, in Creating coupons.
Currently, there are some restrictions to promotion codes:
- You can’t apply a promotion code with amount restrictions on the Customer object or on a subscription update API call
- You can’t apply both a promotion code and a coupon at the same time to a subscription or a customer
- It’s not possible to stack two or more promotion codes