Expiring Codesby Tofu Labs

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.

  1. In Stripe, open Developers, then API keys (or go to dashboard.stripe.com/apikeys).
  2. Click Create restricted key. If Stripe asks how you'll use it, choose the option for giving the key to another website or app.
  3. Name it Expiring Codes.
  4. Set Coupons to Write and Promotion Codes to Write. Leave everything else on None.
  5. Click Create key, copy the key (it starts with rk_live_) and paste it into your Expiring Codes settings.
Trying it out first? Switch Stripe to test mode or a sandbox and make the same key there. It starts with 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:

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.