allow promotion codes (#20387)

Co-authored-by: Peer Richelsen <peeroke@gmail.com>
This commit is contained in:
sean-brydonandPeer Richelsen authored and GitHub committed 2025-03-26 22:51:10 +00:00
1 parent 099c534daa
commit 6bd11009a8
2 files changed
+12 -1

No files matched your search

@@ -30,6 +30,7 @@ export interface BillingService {
quantity: number;
metadata?: Record<string, string | number>;
mode?: "subscription" | "setup" | "payment";
allowPromotionCodes?: boolean;
}): Promise<{ checkoutUrl: string | null; sessionId: string }>;
// Price management
@@ -41,7 +41,16 @@ export class StripeBillingService implements BillingService {
}
async createSubscriptionCheckout(args: Parameters<BillingService["createSubscriptionCheckout"]>[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 {