#_shqnks
1 messages ยท Page 1 of 1 (latest)
Hello ๐
If you don't want to pre-create prices then you can create inline prices using price_data parameter
Hello hanzo, thanks for the fast reply
this is the documentation i'm looking at :
ui_mode: 'embedded',
line_items: [
{
// Provide the exact Price ID (for example, pr_1234) of the product you want to sell
price: '{{PRICE_ID}}',
quantity: 1,
},
],
mode: 'payment',
return_url: `${req.headers.origin}/return?session_id={CHECKOUT_SESSION_ID}`,
});
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Oh I wasn't in the good documentation then ?
https://stripe.com/docs/checkout/embedded/quickstart
You're looking at quickstart guide which mostly focuses on the code
You'd likely want to look at this instead
https://stripe.com/docs/payments/checkout/how-checkout-works#mixed
It explains how you can create inline pricing
hmm I'm tryint to understand and to figure out what to do
so line_items is used when you want to manage your prices in your stripe dashboard, but when you have an online shop, prices evolve often in the backend and it's a wrong way to manage pour prices.
so you tell me that price_data allows me to put my prices when I create the Checkout Session
tell me if I'm wrong somewhere, sorry but it's the first time i'm using Stripe
line_items is the products you're selling through checkout
you'd use price parameter if you pre-create prices and products
you'd use price_data parameter if you want to create prices/products on the fly
so you tell me that price_data allows me to put my prices when I create the Checkout Session
correct.
hmm i dont find anything about price_data on the Checkout section of the API, there are only price_data on Invoices and Subscription sections
all good!
so what I need to do instead of :
(doc example)
line_items: [
{
// Provide the exact Price ID (for example, pr_1234) of the product you want to sell
price: '{{PRICE_ID}}',
quantity: 1,
},
],
is :
line_items: [
{
price_data: {
currency:'EUR',
product_data: {
name: {{my product name}},
description: {{my product description}},
images: {{my product images links}},
unit_amount: {{my product price in int}},
unit_amount_decimal: {{my product price in decimal (string in the doc???) }},
}
},
quantity: {{the quantity of the product validated by the customer}},
},
taw_rates: {{ the tax rate}}
],
does this looks good ?
i'll try it yes, just one last question (for the moment) : I already handle the taxes on the website, but I also have to create the tax rates on the dashboard ? Or can I (like the price_data) send my tax amount directly from there ?
If you're calculating your own taxes then you'd likely want to add it as a line item
Don't think checkout supports sending your own tax amounts in any tax parameters
hmm I don't know if passing the tax as a line item would please my customer
maybe creating all the tax rates possible in the dashboard, then link these ids in my application and send the right tax rate on the checkout would be better
Yeah that would most likely be the only alternative.
Checkout only supports Stripe Tax (automatic tax calculation) or Tax Rates
Ok thanks a lot for your answers you helped me a lot
NP! ๐ Happy to help