#diavo-Checkout
1 messages · Page 1 of 1 (latest)
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?
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,
}
});
}
});```
Hmm I think you can tweak the line_items, set multiples items and one of them to adjustable_quantity, permit the quantity to 0
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Ok i'll check it, and to get a mail when a customer payment./checkout is successful how do i do it ?
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?
https://checkout.stripe.com/pay/cs_test_a1AHl2XAR0N4scGEA1O4NYXKLmxa0kTPrRVi64sik7S7R9UsiTAZgB0xc7#fidkdWxOYHwnPyd1blpxYHZxWjA0T29LaUxEXXdkZE1TcDxiTjFnRjZEa1E1VEJWXFZ%2FVTI3YlRyVlJqUUk1V0psQ1xtYGhCcDRjaE11Nlw1VGBqYXZzdDxMT0lNVUEyQndRZmEwRERsRmNVNTVPfEJISUxINCcpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBabHFgaCcpJ2BrZGdpYFVpZGZgbWppYWB3dic%2FcXdwYHgl yeah it doesnt do anything, i tweeked it like that```line_items: [
{
price: priceId,
quantity: 1,
},
{
price : price_1Jk2kxAXraaHVu9garjoXrnN,
adjustable_quantity:{
enabled : true,
minimum : 0,
maximum: 10,
}
},```
ok
its says "{"error":{"message":"Quantity is required. Add quantity to line_items[1]"}}"
oh, let's add a default quantity then
ok it works mate thanks a lot