Make a Stripe key for Expiring Codes
Expiring Codes needs a restricted key: a Stripe key that can do only what you allow. Ours needs to create coupons and promotion codes, and nothing else. It can't see your customers, payments or payouts.
- In Stripe, open Developers, then API keys (or go to dashboard.stripe.com/apikeys).
- Click Create restricted key. If Stripe asks how you'll use it, choose the option for giving the key to another website or app.
- Name it Expiring Codes.
- Set Coupons to Write and Promotion Codes to Write. Leave everything else on None.
- Click Create key, copy the key (it starts with
rk_live_) and paste it into your Expiring Codes settings.
rk_test_, and test codes only work at test checkouts.Let customers enter the code
Stripe only shows a code box when the checkout allows it:
- Payment Links: edit the link and turn on Allow promotion codes.
- Stripe Checkout (from your own code or a tool like ThriveCart or a site builder):
allow_promotion_codesmust be on. Ask your tool's support if you can't find it.
To fill the code in for the reader, put your Payment Link in the Expiring code block's Button link: we add the code to it. For any other link, write {code} where the code should go, like https://example.com/checkout?prefilled_promo_code={code}. Turn on "Allow promotion codes" on the Payment Link in Stripe.
Why not my secret key?
Your secret key (sk_live_) can do everything in your Stripe account: refunds, payouts, customer data. We don't need any of that, so we don't accept it. "Write" on Coupons and Promotion Codes also lets us read them, which is how we see when a code has been used.
Turn the key off any time under Developers, API keys, or click Disconnect in your settings and we delete it.