From 6bd11009a8e7231bdd2b6f1eda84caf411770851 Mon Sep 17 00:00:00 2001 From: sean-brydon <55134778+sean-brydon@users.noreply.github.com> Date: Wed, 26 Mar 2025 22:51:10 +0000 Subject: [PATCH] allow promotion codes (#20387) Co-authored-by: Peer Richelsen --- packages/features/ee/billing/billing-service.ts | 1 + .../features/ee/billing/stripe-billling-service.ts | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/features/ee/billing/billing-service.ts b/packages/features/ee/billing/billing-service.ts index ebbbd9d2d1..745d3c7c2a 100644 --- a/packages/features/ee/billing/billing-service.ts +++ b/packages/features/ee/billing/billing-service.ts @@ -30,6 +30,7 @@ export interface BillingService { quantity: number; metadata?: Record; mode?: "subscription" | "setup" | "payment"; + allowPromotionCodes?: boolean; }): Promise<{ checkoutUrl: string | null; sessionId: string }>; // Price management diff --git a/packages/features/ee/billing/stripe-billling-service.ts b/packages/features/ee/billing/stripe-billling-service.ts index b9d621a32f..953b9a14e2 100644 --- a/packages/features/ee/billing/stripe-billling-service.ts +++ b/packages/features/ee/billing/stripe-billling-service.ts @@ -41,7 +41,16 @@ export class StripeBillingService implements BillingService { } async createSubscriptionCheckout(args: Parameters[0]) { - const { customerId, successUrl, cancelUrl, priceId, quantity, metadata, mode = "subscription" } = args; + const { + customerId, + successUrl, + cancelUrl, + priceId, + quantity, + metadata, + mode = "subscription", + allowPromotionCodes = true, + } = args; const session = await this.stripe.checkout.sessions.create({ customer: customerId, @@ -55,6 +64,7 @@ export class StripeBillingService implements BillingService { quantity, }, ], + allow_promotion_codes: allowPromotionCodes, }); return {