question

subodhrai avatar image
subodhrai asked ·

com.clover.sdk.v1.ClientException: status code: 400 Invalid tax rate IDs

Getting exception Invalid tax rate IDs when adding tax rate on item,

I want to add tax rate programmatically on specific item.


this how i'm doing

inventoryConnector().assignTaxRatesToItem(
    itemId,
    listTaxRates
)


Thank you

PaymentsInventoryTaxes
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
David Marginian avatar image
David Marginian answered ·

What environment? What is your merchant id? Can you provide the data in the request you are making?

8 comments
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sandbox as environment and the data in the request are making:-

 item.defaultTaxRates = true
 val listTaxRates: ArrayList<String> = ArrayList()
 val taxRate = TaxRate()
 taxRate.isDefault = true
 taxRate.name = "Default"
 taxRate.id = item.taxRates[0].id
 taxRate.rate = 0
 taxRate.taxAmount = 200
listTaxRates.add(taxRate.name)
listTaxRates.add(taxRate.id)
listTaxRates.add(taxRate.rate.toString())
listTaxRates.add(taxRate.taxAmount.toString())
try {

    inventoryConnector().assignTaxRatesToItem(
        itemId,
        listTaxRates
    )
} catch (e: java.lang.Exception) {
    e.printStackTrace()
}
0 Likes 0 ·

That request doesn't make much sense, you are going to end up with an arraylist with the following items:

[taxRate.name, taxRate.id, taxRate.rate, taxRate.amount]

I believe what you want is a arraylist with a single item that is the Clover uuid of the tax rate:

[taxRate.id]


0 Likes 0 ·
subodhrai avatar image subodhrai David Marginian ♦♦ ·

yes, so please can you help me how we can achieve this(add tax on item),

I have tried with different approaches.

I have also tried with

 item.defaultTaxRates = true
 val listTaxRates: ArrayList<TaxRate> = ArrayList()
 val taxRate = TaxRate()
 taxRate.isDefault = true
 taxRate.name = "Default"
 taxRate.id = item.taxRates[0].id
 taxRate.rate = 0
 taxRate.taxAmount = 200
 listTaxRates.add(taxRate)
 item.taxRates=listTaxRates

this approach but it also not work.

0 Likes 0 ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community