#senthil-taxrate-php
1 messages · Page 1 of 1 (latest)
Hi, are you able to share the request id for when you see this error please? Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
(Status 400) (Request req_Vo3L5E3QaFtWhA) Invalid array
More recent req id: (Status 400) (Request req_cN4OCeWKUmfazq) Invalid array
'line_items' => [
[
'price' => $model->pgwpriceid,
'quantity' => $model->tquantity,
'tax_rates' => 'txr_1LnOW3HCn1jZYbVVazXRzW51',
],
],
It works without the tax_rates
Can you share the request id where it works?
Could you try this?
‘line_items’ => [ { ‘price’ => $model->pgwpriceid, ‘quantity’ => $model->tquantity, ‘tax_rates’ => ‘txr_1LnOW3HCn1jZYbVVazXRzW51’, }, ],
req_G9zr42R6u9tWJk
Change square brackets to angle?
req_G9zr42R6u9tWJk is an e.g. where it worked
syntax error, unexpected '{', expecting ']'
PHP does not like [ to {, which is expected
Yeap, I failed to see that it was Php, looking to see if I can reproduce this.
ok thanks appreciate it
Can you pass the 'tax_rates' as an array?
👋 stepping in
Tax rates here should be an array so ‘line_items’ => [ ‘price’ => $model->pgwpriceid, ‘quantity’ => $model->tquantity, [‘tax_rates’ => [‘txr_1LnOW3HCn1jZYbVVazXRzW51’]], ],
That said let's back up
Why are you using tax rates and Auto tax at the same time?
ok let me try
Get different error: req_Do2EsnGGAYbAHy
parameter_unknown - line_items[0][0]
I also changed tax rate enabled to false
or rather automatic tax enabled to false
Oh I added an extra set of []
Sorry
‘price’ => $model->pgwpriceid,
‘quantity’ => $model->tquantity,
‘tax_rates’ => [‘txr_1LnOW3HCn1jZYbVVazXRzW51’],
],```
Works! Thanks so much!
Why is it an array? May need to update documentation unless you know what else may be passed in the array (that is not documented)
It is an array because you can pass multiple values here
Multiple tax rates? Or something else? Can you expand more?
Yes multiple tax rates
How does it know which one to use?
👍