- Home /

Hello, I would like to understand how to calculate tax for orders created via API. Per Clover documentation at https://docs.clover.com/build/web-app...

I see tax calculation is only done at once on order working total. How is this possible to calculate it at order level since every inventory item in clover can be associated with one or more tax rates? How do i apply these tax rates at order level?

I am using pay api to make a payment for the order with my calculated totals that is turning out a cent less or more that the order total that clover calculates thru the Orders app. So i would like to know how to calculate tax properly if it needs to be done per item and its tax rates and/or on whole order sum total?

Could you kindly clarify?

Regards, Liju

Comment

**Answer** by Jacob Abrams
·
Oct 26, 2015 at 03:44 PM

Since you are performing this calculation on your server you will need to do a little bit more work. We provide a pure Java calc.jar that we use to perform calculations. You can get it here: https://github.com/clover/clover-andr...

Import that JAR into your project and then use the internal Calc class to perform computations. You will probably want to have some kind of Java classes to represent Clover orders that you convert from JSON, you can GSON or Jackson to convert the JSON to your instances. Once you have Order objects you need to implement the Calc.Order interface and give it to Calc instance like so:

`com.clover.core.internal.calc.Calc.Order calcOrder = new com.clover.core.internal.calc.Calc.Order() {`

```
```

// TODO: Implement all Calc.Order methods using your own Clover Order object

};

Calc c = new Calc(calcOrder);
c.getTax();

Take a look at https://github.com/clover/clover-andr... for an example how we implemented this interface for our Android SDK, you won't be able to use our v3 classes on your server, you will implement the interface using your own classes.

Sorry we don't supply a Javascript calculation library. You could try using a Node.js to Java bridge such as https://github.com/joeferner/node-java

Copyright © 2010-16 DZone, Inc. - All rights reserved.

- Anonymous
- Sign in
- Create
- Ask a question
- Create an article
- Spaces
- Help
- Explore
- Topics
- Questions
- Users
- Badges