PromotionCode
Source:
src/Stripe/PromotionCode.ts
A Stripe Promotion Code — a customer-redeemable code for an underlying
coupon. Stripe does not hard-delete promotion codes; destroying this
resource deactivates it (active: false).
code, coupon, customer, expiresAt, maxRedemptions, and most
restrictions are immutable. Changing them replaces the promotion code
(create a new one, then deactivate the old). active, metadata, and
restrictions.currencyOptions update in place.
Creating a Promotion Code
Section titled “Creating a Promotion Code”Code for an existing coupon
const welcome = yield* Stripe.PromotionCode("welcome", { coupon: "25OFF", code: "WELCOME25",});Generated code with a redemption cap
const launch = yield* Stripe.PromotionCode("launch", { coupon: "10OFF", maxRedemptions: 100, metadata: { campaign: "launch" },});Updating a Promotion Code
Section titled “Updating a Promotion Code”const welcome = yield* Stripe.PromotionCode("welcome", { coupon: "25OFF", code: "WELCOME25", active: false, metadata: { campaign: "paused" },});Deactivating a Promotion Code
Section titled “Deactivating a Promotion Code”// stack.destroy() / resource removal sets active: falseconst welcome = yield* Stripe.PromotionCode("welcome", { coupon: "25OFF", code: "WELCOME25",});