question

agiletechstudio avatar image
agiletechstudio asked David Marginian Deactivated commented

No Tax is Showing on Clover Machine

I am creating a line items and setting a tax rates , but on machine there is no tax and subtotal is showing. Here is my code that i am doing. Here is Screenshot of machine .afca91a1-e10a-497b-ab35-52127e1e1a80.jpeg

Here is the my source Code and also quantity is not displaying on screen.

var taxRates = [];

var tax = new clover.inventory.TaxRate();

tax.setId("5");

tax.setName("VAT");

tax.setRate(5000);

//tax.setTaxAmount(50);

tax.setIsDefault(true);

taxRates.push(tax);


var lineitem2 = new clover.order.LineItem();

lineitem2.setId("1");

lineitem2.setName("testing product");

lineitem2.setPrice(300);

lineitem2.setUnitQty(2);

lineitem2.setIsRevenue(true);

lineitem2.setTaxRates(taxRates);


var lineItemTax = new clover.order.LineItemTaxRates();

lineItemTax.setRates("1", taxRates);

lineItemTax.setRates("1234", taxRates);

lineItemTax.setRates("123", taxRates);

lineItemTax.setRates("12366", taxRates);

lineItemTax.setRates("12365", taxRates);

var order = new clover.order.Order();

order.setTitle("Hi Trent");

order.setId(1234);

order.setLineItems([lineitem2, item, item2, item3, item4]);
cloverConnector.showDisplayOrder(order);

OrdersLineItems
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

·
David Marginian avatar image
David Marginian Deactivated answered David Marginian Deactivated commented

You must reference existing taxRates in your taxRates collection, you can't simply pass a new taxRate. If you want to create a new taxRate see InventoryConnector.createTaxRate2. If you want to obtain a list of the existing tax rates see InventoryConnector.getTaxRates.

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.

Same issue is coming i can not see the tax on clover machine. can you please send me some sample code to print order on clover machine with passing items , quantity , price and tax , order total and subtotal. Thanks
var taxRates = [];


var tax = new clover.inventory.TaxRate();

tax.setId("5");

tax.setName("VAT");

tax.setRate(5000);

//tax.setTaxAmount(50);

tax.setIsDefault(true);

/*tax.setId(created.id)*/

taxRates.push(tax);



var lineitem7 = new clover.inventory.Item();

lineitem7.setId("1325");

lineitem7.setName("testing product256");

lineitem7.setPrice(300);

lineitem7.setIsRevenue(true);

lineitem7.setDefaultTaxRates(true);

lineitem7.setTaxRates(taxRates);

var lineitem2 = new clover.order.LineItem();

lineitem2.setItem(lineitem7);

lineitem2.setId("1");

lineitem2.setName("testing product");

lineitem2.setPrice(300);

lineitem2.setUnitQty(2);

lineitem2.setIsRevenue(true);

lineitem2.setTaxRates(taxRates);

var order = new clover.order.Order();

order.setTitle("Hi Trent");

order.setId(1234);

order.setLineItems([lineitem2]);


cloverConnector.showDisplayOrder(order)

0 Likes 0 ·

Yes, that is expected, tax.setId("5"), 5 is not a valid/existing tax rate. You need to first create the tax rate (via the InventoryConnector API per my previous post) and then pass the id of that tax rate (you can't just make up an arbitrary id).

0 Likes 0 ·
agiletechstudio avatar image agiletechstudio David Marginian ♦♦ ·
Can you please send me sample code how to set tax rate by inventory connector and then pass it to order. Thanks
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