mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-10 07:48:37 +01:00
fix payments
This commit is contained in:
@@ -5,11 +5,13 @@ class StripeService {
|
||||
private stripe?: Stripe;
|
||||
private privateKey?: string;
|
||||
private webhookSecret?: string;
|
||||
public testMode?: boolean;
|
||||
|
||||
init(privateKey: string, webhookSecret: string) {
|
||||
init(privateKey: string, webhookSecret: string, testMode: boolean = false) {
|
||||
this.privateKey = privateKey;
|
||||
this.webhookSecret = webhookSecret;
|
||||
this.stripe = new Stripe(this.privateKey);
|
||||
this.testMode = testMode;
|
||||
}
|
||||
|
||||
parseWebhook(body: any, sig: string) {
|
||||
@@ -87,7 +89,7 @@ class StripeService {
|
||||
const subscription = await this.stripe.subscriptions.create({
|
||||
customer: customer_id,
|
||||
items: [
|
||||
{ price: FREE_PLAN.PRICE, quantity: 1 }
|
||||
{ price: this.testMode ? FREE_PLAN.PRICE_TEST : FREE_PLAN.PRICE, quantity: 1 }
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user