Coupon
Source:
src/Stripe/Coupon.ts
A Stripe Coupon — a percent-off or amount-off discount applied to subscriptions, invoices, Checkout sessions, and quotes. Coupons do not apply to one-off charges or PaymentIntents.
Create with either percentOff or amountOff + currency. duration
is forever, once (the default), or repeating (requires
durationInMonths). Name, metadata, and currencyOptions update in
place; the discount shape is immutable and changing it replaces the
coupon.
Creating a Coupon
Section titled “Creating a Coupon”Percent-off forever
const welcome = yield* Stripe.Coupon("welcome", { percentOff: 20, duration: "forever", name: "Welcome 20%",});Amount-off once
const fiveOff = yield* Stripe.Coupon("five-off", { amountOff: 500, currency: "usd", duration: "once", name: "$5 off",});Repeating duration
Section titled “Repeating duration”const quarterly = yield* Stripe.Coupon("quarterly", { percentOff: 10, duration: "repeating", durationInMonths: 3,});Updating a Coupon
Section titled “Updating a Coupon”const welcome = yield* Stripe.Coupon("welcome", { percentOff: 20, duration: "forever", name: "Welcome 20% (updated)", metadata: { campaign: "spring" },});