From ac81bfaec27e3a50dad1d8b129c6f958822c48cb Mon Sep 17 00:00:00 2001 From: adueck Date: Sat, 15 Oct 2022 09:40:15 +0500 Subject: [PATCH] priceId --- account/src/routers/payment-router.ts | 12 ++---------- account/views/user.ejs | 8 ++++---- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/account/src/routers/payment-router.ts b/account/src/routers/payment-router.ts index 3e91e4c..9217c03 100644 --- a/account/src/routers/payment-router.ts +++ b/account/src/routers/payment-router.ts @@ -80,20 +80,12 @@ paymentRouter.post("/create-checkout-session", async (req, res, next) => { return next("not logged in"); } try { - const prices = await stripe.prices.list({ - expand: ['data.product'], - }); + const price = req.body.priceId; const session = await stripe.checkout.sessions.create({ billing_address_collection: 'auto', line_items: [ { - price: prices.data[0].id, - // For metered billing, do not pass quantity - quantity: 1, - }, - { - price: prices.data[1].id, - // For metered billing, do not pass quantity + price, quantity: 1, }, ], diff --git a/account/views/user.ejs b/account/views/user.ejs index 68279c2..434a3cd 100644 --- a/account/views/user.ejs +++ b/account/views/user.ejs @@ -63,13 +63,13 @@ <% if (user.tester) { %>

Upgrade to Student account for Wordlist features

- - + +
- + <% } %> <% } %> <% if (user.tester && user.level === "student") { %>