#Beninate-automatic_tax
1 messages ยท Page 1 of 1 (latest)
That sounds like it is expecting a price object https://stripe.com/docs/api/prices
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I'm guessing here you are providing the price data (amount and such) at the time of making this call?
we are providing line_items when creating a session, each with their own amount
like such as
cart.cart_items.each do |cart_item|
line_items << {
name: 'Foo',
description: 'Bar',
amount: 1000,
currency: 'usd',
quantity: 1,
}
end
stripe_session = Stripe::Checkout::Session.create(
line_items: line_items,
automatic_tax: {
enabled: true
},
)
There we go, that is what I was trying to describe. When it says "when not using prices" it is referring to the fact that it wants you to pass in the id of a Price object to the line items price param rather than using the price_data fields like amount and currency https://stripe.com/docs/api/checkout/sessions/create?lang=node#create_checkout_session-line_items-price
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
oooh. So for each item (of a different price) available to purchase in our "shop", we should create a formal Price object, and reference that?
Correct, if you want to use automatic_tax you'll need them to be those price objects
understood, thanks for the clarification, i had no idea
one more question, should we also be creating a Product for every item, or that's optional?