Skip to content

Commit

Permalink
increase tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
fac3m4n committed Apr 14, 2024
1 parent dee96a8 commit acfb5f8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion StripeService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class StripeService {
ssl: true,
});

async createCheckoutSession(): Promise<string> {
async createCheckoutSession(userId: string): Promise<string> {
const stripePromise = await stripe.checkout.sessions.create({
line_items: [
{
Expand All @@ -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 || "";
}

Expand Down

0 comments on commit acfb5f8

Please sign in to comment.