chore: support allow promotion code in price config
This commit is contained in:
parent
cfbfa409b0
commit
bd67ac3517
@ -119,6 +119,7 @@ export const websiteConfig: WebsiteConfig = {
|
||||
priceId: process.env.NEXT_PUBLIC_STRIPE_PRICE_LIFETIME!,
|
||||
amount: 19900,
|
||||
currency: 'USD',
|
||||
allowPromotionCode: true,
|
||||
},
|
||||
],
|
||||
isFree: false,
|
||||
|
@ -227,6 +227,7 @@ export class StripeProvider implements PaymentProvider {
|
||||
success_url: successUrl ?? '',
|
||||
cancel_url: cancelUrl ?? '',
|
||||
metadata: customMetadata,
|
||||
allow_promotion_codes: price.allowPromotionCode ?? false,
|
||||
};
|
||||
|
||||
// Add customer to checkout session
|
||||
|
@ -46,16 +46,17 @@ export interface Price {
|
||||
currency: string; // Currency code (e.g., USD)
|
||||
interval?: PlanInterval; // Billing interval for recurring payments
|
||||
trialPeriodDays?: number; // Free trial period in days
|
||||
allowPromotionCode?: boolean; // Whether to allow promotion code for this price
|
||||
disabled?: boolean; // Whether to disable this price in UI
|
||||
}
|
||||
|
||||
/**
|
||||
* Price plan definition
|
||||
*
|
||||
*
|
||||
* 1. When to set the plan disabled?
|
||||
* When the plan is not available anymore, but you should keep it for existing users
|
||||
* who have already purchased it, otherwise they can not see the plan in the Billing page.
|
||||
*
|
||||
*
|
||||
* 2. When to set the price disabled?
|
||||
* When the price is not available anymore, but you should keep it for existing users
|
||||
* who have already purchased it, otherwise they can not see the price in the Billing page.
|
||||
|
1
src/types/index.d.ts
vendored
1
src/types/index.d.ts
vendored
@ -1,4 +1,5 @@
|
||||
import type { ReactNode } from 'react';
|
||||
import type { PricePlan } from '@/payment/types';
|
||||
|
||||
/**
|
||||
* website config, without translations
|
||||
|
Loading…
Reference in New Issue
Block a user