This commit is contained in:
adueck 2022-10-15 09:40:15 +05:00
parent d77bc84d79
commit ac81bfaec2
2 changed files with 6 additions and 14 deletions

View File

@ -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,
},
],

View File

@ -63,13 +63,13 @@
<% if (user.tester) { %>
<p>Upgrade to Student account for Wordlist features</p>
<form action="/payment/create-checkout-session" method="POST">
<!-- <input type="hidden" name="productId" value="prod_McF18BoMSgnLcQ" /> -->
<button class="btn btn-sm btn-secondary" type="submit">Upgrade Account</button>
<input type="hidden" name="priceId" value="price_1Lt0XdJnpCQCjf9pM9qqdyt6" />
<button class="btn btn-sm btn-secondary" type="submit">$1/year</button>
</form>
<!-- <form action="/payment/create-checkout-session" method="POST">
<form action="/payment/create-checkout-session" method="POST">
<input type="hidden" name="priceId" value="price_1Lt0XdJnpCQCjf9pHk1MQqCC" />
<button class="btn btn-sm btn-secondary mt-2" type="submit">$10/year</button>
</form> -->
</form>
<% } %>
<% } %>
<% if (user.tester && user.level === "student") { %>