question

wsadiq avatar image
wsadiq asked chanel Deactivated answered

Adding Custom Line Item

Hello,

We are using Clover SDK to build a native application. For our giftcard sale, we create an order and add a custom line. What we are noticing is that when we add the line item and obtain a fresh copy of the order from the order connector, tax has been added using default tax rate. How do we prevent tax from being added automatically.

1. mOrder = new Order();
2. mOrder = orderConnector.createOrder(mOrder);
3. LineItem item = new LineItem();
4. item.setAlternateName("giftcard name);
5. item.setName("giftcard name");
6. item.setPrice(cardSalePrice);
7. item.setTaxRates(null);
8. item.setUnitQty(1);
9. orderConnector.addCustomLineItem(mOrder.getId(), item, true);
10. ordermOrder = orderConnector.getOrder(mOrder.getId());

Thanks.
OrdersLineItemsTaxes
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

chanel avatar image
chanel Deactivated answered
You can prevent tax being added by setting isTaxable to false when you add the item to the order. This will prevent default taxes from being applied to your giftcard.

So you would want to change line 9 to be:
orderConnector.addCustomLineItem(mOrder.getId(), item, false);

You can find the relevant documentation here:
https://clover.github.io/clover-android-sdk/com/cl...
10 |2000

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