#senthil-taxrate-php

1 messages · Page 1 of 1 (latest)

sleek karmaBOT
vapid oriole
graceful crescent
#

(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

vapid oriole
#

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’, }, ],

graceful crescent
#

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

vapid oriole
#

Yeap, I failed to see that it was Php, looking to see if I can reproduce this.

graceful crescent
#

ok thanks appreciate it

vapid oriole
#

Can you pass the 'tax_rates' as an array?

slow valley
#

👋 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?

graceful crescent
#

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

slow valley
#

Oh I added an extra set of []

#

Sorry

#
    ‘price’ => $model->pgwpriceid, 
    ‘quantity’ => $model->tquantity,   
    ‘tax_rates’ => [‘txr_1LnOW3HCn1jZYbVVazXRzW51’],  
],```
graceful crescent
#

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)

slow valley
#

It is an array because you can pass multiple values here

graceful crescent
#

Multiple tax rates? Or something else? Can you expand more?

slow valley
#

Yes multiple tax rates

graceful crescent
#

How does it know which one to use?

graceful crescent
#

👍