#_shqnks

1 messages ยท Page 1 of 1 (latest)

cedar relicBOT
steel oxide
#

Hello ๐Ÿ‘‹
If you don't want to pre-create prices then you can create inline prices using price_data parameter

empty violet
#

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}`,
        });
steel oxide
empty violet
steel oxide
#

It explains how you can create inline pricing

empty violet
#

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

steel oxide
#

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.

empty violet
#

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

empty violet
#

my bad sorry

#

ctrl+F trolled me

steel oxide
#

all good!

empty violet
#

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 ?

steel oxide
#

yup

#

think so

#

try it out

empty violet
#

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 ?

steel oxide
#

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

empty violet
#

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

steel oxide
#

Yeah that would most likely be the only alternative.
Checkout only supports Stripe Tax (automatic tax calculation) or Tax Rates

empty violet
#

Ok thanks a lot for your answers you helped me a lot

steel oxide
#

NP! ๐Ÿ™‚ Happy to help