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");
|
return next("not logged in");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const prices = await stripe.prices.list({
|
const price = req.body.priceId;
|
||||||
expand: ['data.product'],
|
|
||||||
});
|
|
||||||
const session = await stripe.checkout.sessions.create({
|
const session = await stripe.checkout.sessions.create({
|
||||||
billing_address_collection: 'auto',
|
billing_address_collection: 'auto',
|
||||||
line_items: [
|
line_items: [
|
||||||
{
|
{
|
||||||
price: prices.data[0].id,
|
price,
|
||||||
// For metered billing, do not pass quantity
|
|
||||||
quantity: 1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
price: prices.data[1].id,
|
|
||||||
// For metered billing, do not pass quantity
|
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
@ -63,13 +63,13 @@
|
||||||
<% if (user.tester) { %>
|
<% if (user.tester) { %>
|
||||||
<p>Upgrade to Student account for Wordlist features</p>
|
<p>Upgrade to Student account for Wordlist features</p>
|
||||||
<form action="/payment/create-checkout-session" method="POST">
|
<form action="/payment/create-checkout-session" method="POST">
|
||||||
<!-- <input type="hidden" name="productId" value="prod_McF18BoMSgnLcQ" /> -->
|
<input type="hidden" name="priceId" value="price_1Lt0XdJnpCQCjf9pM9qqdyt6" />
|
||||||
<button class="btn btn-sm btn-secondary" type="submit">Upgrade Account</button>
|
<button class="btn btn-sm btn-secondary" type="submit">$1/year</button>
|
||||||
</form>
|
</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" />
|
<input type="hidden" name="priceId" value="price_1Lt0XdJnpCQCjf9pHk1MQqCC" />
|
||||||
<button class="btn btn-sm btn-secondary mt-2" type="submit">$10/year</button>
|
<button class="btn btn-sm btn-secondary mt-2" type="submit">$10/year</button>
|
||||||
</form> -->
|
</form>
|
||||||
<% } %>
|
<% } %>
|
||||||
<% } %>
|
<% } %>
|
||||||
<% if (user.tester && user.level === "student") { %>
|
<% if (user.tester && user.level === "student") { %>
|
||||||
|
|
Loading…
Reference in New Issue