#burt-tax-rates

1 messages · Page 1 of 1 (latest)

minor nebula
#

Where is the error surfacing?

slender cloud
#

const session = await stripe.checkout.sessions.create({
line_items: myArray,
mode: 'payment',
success_url: http://localhost:3000/ordersuccess?success=true,
cancel_url: http://localhost:3000/cart?canceled=true,
automatic_tax: { enabled: true },
});

#

myArray is an array of objects that are {price: 'xxx', quantity: 1}

#

which works fine, but when I add to make those objects in the line_items array to be {price: 'xxx', quantity: 1, rax_rates: 'xxx'} I receive the invalid array error

minor nebula
#

So line_items takes and array of hashes

#

So you'll want myArray to look like:

line_items: [ { price: 'xxx', quantity: 1 } ]

slender cloud
#

which it does

minor nebula
#

Or :
line_items: [{price: 'xxx', quantity: 1}]

slender cloud
#

adding tax_rates seems like it should be possible from the API docs? but doing so gives me the invalid array error

#

So the error is this:

#

line_items: [{price: 'xxx', quantity: 1, tax_rates: 'xxx'}]

#

line_items in the API reference also has "line_items.tax_rates
optional
The tax rates which apply to this line item."

minor nebula
#

Can you enclose the value for tax_rates in square brackets?

In other words, does this work?
line_items: [{price: 'xxx', quantity: 1, tax_rates: ['xxx']}]

#

Or this?
line_items: [{price: 'xxx', quantity: 1, tax_rates: {'xxx'}}]

slender cloud
#

square brackets worked! Thanks a ton, tried multiple things but that wasn't one of them

#

You've helped me twice now is there a way to give you 5 stars or something?