question

psaner avatar image
psaner asked Alan commented

How to add sales tax via REST API

I have been able to create, update and or delete an order and line item(s) and they show up in the clover device (test mode) via the clover REST API. However, there is no sales tax showing on the order in the device. How do I assign sales tax to the REST API JSON object to make it show up in the device? Also, should I do it by line item or on the order itself? I can't find anywhere in the API docs that tell me. Thanks in advance for your answer.

Sale
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

psaner avatar image
psaner answered Alan commented

We did a GET on the tax rates for the clover device, pasted element for the appropriate taxt rate as the first element in the tax rates object array of the line item. Worked like a charm. Here is a snippet of the code: 'json' => [ "note" => "Clover Order Id: ".$this->cloverId."", "name" => $qty." ".$oio->getCloverString(), "price" => $qty * ($oio->getPrice() * 100), "taxRates" => [ $this->taxRateArray ], "testMode" => $this->testMode ] ]); $subtotal += $oio->getSubtotal();
} // foreach $rate = $this->taxRateArray['rate']/10000000; $tax = round($subtotal * $rate, 2, PHP
ROUNDHALFUP); $this->orderTotal = $subtotal + $tax; intval($this->orderTotal *= 100);

Hope it helps.

4 comments
10 |2000

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

@psaner I'm also having issues with this, and i'm adding the tax rates to the line items. I can see the tax rates exist on the order, but they're not appearing in the reporting app. Did you do anything else?

0 Likes 0 ·

Alan, I added a snippet of code to my orig answer, not using the reporting app, but may need some sort of data manip. to see the numbers. This is how we did it in PHP. Hope it helps. Let me know if you need additional info.

0 Likes 0 ·

Thanks psaner, I'm able to see the tax rates are attached to my items, but my issue is that the reporting app doesn't include my items. Are your items included in the reporting app?

0 Likes 0 ·

Wish I could help. I don't use the reporting app, so I don't know what it would take to see the items. I interfaced Clover with a PHP app I'd written for a client so she could take payment through the Clover device. I will say Clover has really improved their documentation. I assume you explicitly get all line Items for an order? I did learn that the line items are separate from the actual order. I'll ask around a bit too for other suggestions.

0 Likes 0 ·

Welcome to the
Clover Developer Community