Skip to content

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.

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" },
});
const welcome = yield* Stripe.PromotionCode("welcome", {
coupon: "25OFF",
code: "WELCOME25",
active: false,
metadata: { campaign: "paused" },
});
// stack.destroy() / resource removal sets active: false
const welcome = yield* Stripe.PromotionCode("welcome", {
coupon: "25OFF",
code: "WELCOME25",
});