diff --git a/src/api/functions/stripe.ts b/src/api/functions/stripe.ts index 178183d0..0faa97e3 100644 --- a/src/api/functions/stripe.ts +++ b/src/api/functions/stripe.ts @@ -17,6 +17,7 @@ export type StripeCheckoutSessionCreateParams = { stripeApiKey: string; items: { price: string; quantity: number }[]; initiator: string; + allowPromotionCodes: boolean; }; /** @@ -71,6 +72,7 @@ export const createCheckoutSession = async ({ customerEmail, items, initiator, + allowPromotionCodes, }: StripeCheckoutSessionCreateParams): Promise => { const stripe = new Stripe(stripeApiKey); const payload: Stripe.Checkout.SessionCreateParams = { @@ -86,6 +88,7 @@ export const createCheckoutSession = async ({ metadata: { initiator, }, + allow_promotion_codes: allowPromotionCodes, }; const session = await stripe.checkout.sessions.create(payload); if (!session.url) { diff --git a/src/api/routes/membership.ts b/src/api/routes/membership.ts index 6e08bc27..ab4963cc 100644 --- a/src/api/routes/membership.ts +++ b/src/api/routes/membership.ts @@ -139,6 +139,7 @@ const membershipPlugin: FastifyPluginAsync = async (fastify, _options) => { { price: fastify.environmentConfig.PaidMemberPriceId, quantity: 1 }, ], initiator: "purchase-membership", + allowPromotionCodes: true, }), ); });