#diavo-Checkout

1 messages · Page 1 of 1 (latest)

smoky hull
#

Hi, I am not sure I follow the question. Everything on a Checkout Session would need to be pre-configured by when you create it on server side. What exactly would you want to achieve?

lucid vigil
#

For example

#

Customer choose Start pack (20 dollars subscription, its google analytics like that works for 1 website) during checkout he can choose an option : add an additionnal website (for tracker) for 5 dollars

#

and the price is dynamically changed if he choose 5 dollars, here 25 dollars

#

but i already have that ```app.post("/create-checkout-session", async (req, res) => {
const domainURL = process.env.DOMAIN;
const { priceId } = req.body;
try {
const session = await stripe.checkout.sessions.create({
phone_number_collection: {
enabled: true,
},
billing_address_collection: 'required',
mode: "subscription",
payment_method_types: ["card"],
line_items: [
{
price: priceId,
quantity: 1,
},
],
success_url: ${domainURL}/success.html?session_id={CHECKOUT_SESSION_ID},
cancel_url: ${domainURL}/canceled.html,

});
return res.redirect(303, session.url);

} catch (e) {
res.status(400);
return res.send({
error: {
message: e.message,
}
});
}
});```

smoky hull
#

Hmm I think you can tweak the line_items, set multiples items and one of them to adjustable_quantity, permit the quantity to 0

lucid vigil
#

Ok i'll check it, and to get a mail when a customer payment./checkout is successful how do i do it ?

smoky hull
#

Hmm I am not sure about that. You want to receive email as a merchant?

#

Could you write in or chat with Support for that question?

lucid vigil
#
#

ok

lucid vigil
#

its says "{"error":{"message":"Quantity is required. Add quantity to line_items[1]"}}"

smoky hull
#

oh, let's add a default quantity then

lucid vigil
#

ok it works mate thanks a lot