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 || ""; }