question

smerchanton avatar image
smerchanton asked smerchanton commented

Link Items with Taxes

What json value do you send to the end point to link items with tax rates. I currently have this and its not working.

  1. $curl=curl_init('https://sandbox.dev.clover.com/v3/merchants/{MID}/category_items');

  2. curl_setopt($curl, CURLOPT_HTTPHEADER, array(
  3. "Authorization:Bearer " . $accessToken,
  4. 'Content-Type: application/json',
  5. )
  6. );
  7. $data = "{ "elements": [ { "taxRates": {"id": "abc"}, "item": {"id": "123"} } ] }";

  8. curl_setopt( $curl, CURLOPT_POST, true );
  9. curl_setopt( $curl, CURLOPT_POSTFIELDS, $data);
  10. curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

  11. $auth = curl_exec($curl);
  12. $info = curl_getinfo($curl);
  13. $result=json_decode($auth, true);


I am getting the error invalid value in json.

Taxes
10 |2000

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

1 Answer

·
bryanvargas avatar image
bryanvargas answered smerchanton commented

You have to use the /v3/merchants/{mId}/tax_rate_items endpoint to create an association between items and tax rates.

More information on the API can be found here: https://docs.clover.com/reference/taxratecreateordeletetaxrateitems

1 comment
10 |2000

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

smerchanton avatar image smerchanton commented ·

Thanks. How do you structure the json values for this endpoint?

I tried the fields below but they didn't work.

$data = "{ "elements": [ { "taxRates": {"id": "abc"}, "item": {"id": "123"} } ] }";

0 Likes 0 ·

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