From acfb5f8c176242bcb4d5e16f349ebcf1ed9f6d68 Mon Sep 17 00:00:00 2001 From: fac3m4n Date: Sun, 14 Apr 2024 10:24:16 +0300 Subject: [PATCH] increase tokens --- StripeService.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/StripeService.ts b/StripeService.ts index 1ebc5b8..728197d 100644 --- a/StripeService.ts +++ b/StripeService.ts @@ -18,7 +18,7 @@ export class StripeService { ssl: true, }); - async createCheckoutSession(): Promise { + async createCheckoutSession(userId: string): Promise { const stripePromise = await stripe.checkout.sessions.create({ line_items: [ { @@ -37,6 +37,11 @@ export class StripeService { cancel_url: `${process.env.FRONTEND_URL}?canceled=true`, }); + await this.pool.query( + "update credits set credits = credits + 10 where userId = $1", + [userId] + ); + return stripePromise.url || ""; }