feat: add promotion codes support to SMS credit purchases (#23774)
Co-authored-by: [email protected] <[email protected]> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: CarinaWolli <[email protected]> Co-authored-by: Anik Dhabal Babu <[email protected]>
This commit is contained in:
2 files changed
+4
-1
No files matched your search
@@ -44,8 +44,9 @@ export class StripeBillingService implements IBillingProviderService {
|
||||
successUrl: string;
|
||||
cancelUrl: string;
|
||||
metadata?: Record<string, string>;
|
||||
allowPromotionCodes?: boolean;
|
||||
}) {
|
||||
const { priceId, quantity, successUrl, cancelUrl, metadata } = args;
|
||||
const { priceId, quantity, successUrl, cancelUrl, metadata, allowPromotionCodes = true } = args;
|
||||
|
||||
const session = await this.stripe.checkout.sessions.create({
|
||||
line_items: [{ price: priceId, quantity }],
|
||||
@@ -53,6 +54,7 @@ export class StripeBillingService implements IBillingProviderService {
|
||||
success_url: successUrl,
|
||||
cancel_url: cancelUrl,
|
||||
metadata: metadata,
|
||||
allow_promotion_codes: allowPromotionCodes,
|
||||
invoice_creation: {
|
||||
enabled: true,
|
||||
},
|
||||
|
||||
@@ -77,6 +77,7 @@ export const buyCreditsHandler = async ({ ctx, input }: BuyCreditsOptions) => {
|
||||
quantity,
|
||||
successUrl: redirectUrl,
|
||||
cancelUrl: redirectUrl,
|
||||
allowPromotionCodes: true,
|
||||
metadata: {
|
||||
...(teamId && { teamId: teamId.toString() }),
|
||||
userId: ctx.user.id.toString(),
|
||||
|
||||
Reference in new issue
Block a user