priceId
This commit is contained in:
parent
d77bc84d79
commit
ac81bfaec2
|
@ -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,
|
||||
},
|
||||
],
|
||||
|
|
|
@ -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") { %>
|
||||
|
|
Loading…
Reference in New Issue