This commit is contained in:
parent
af87faf9ed
commit
f82173ee07
|
@ -22,24 +22,24 @@ paymentRouter.post("/create-checkout-session", async (req, res, next) => {
|
||||||
console.log("with key", env.stripeSecretKey);
|
console.log("with key", env.stripeSecretKey);
|
||||||
try {
|
try {
|
||||||
const prices = await stripe.prices.list({
|
const prices = await stripe.prices.list({
|
||||||
lookup_keys: [req.body.lookup_key],
|
lookup_keys: [req.body.lookup_key],
|
||||||
expand: ['data.product'],
|
expand: ['data.product'],
|
||||||
});
|
});
|
||||||
console.log(prices);
|
console.log(prices);
|
||||||
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: prices.data[0].id,
|
||||||
// For metered billing, do not pass quantity
|
// For metered billing, do not pass quantity
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
mode: 'subscription',
|
mode: 'subscription',
|
||||||
// TODO ADD URLS
|
// TODO ADD URLS
|
||||||
success_url: `/`,
|
success_url: `https://account.lingdocs.com/`,
|
||||||
cancel_url: `/`,
|
cancel_url: `https://account.lingdocs.com/`,
|
||||||
});
|
});
|
||||||
if (!session.url) {
|
if (!session.url) {
|
||||||
return next("error creating session url");
|
return next("error creating session url");
|
||||||
|
|
Loading…
Reference in New Issue