Connecting to Taxamo from Java

Taxamo provides free, Swagger-codegen generated bindings to the RESTful API. Source code is available as a github repo:

The project is also used to report Taxamo Java API related issues:

Please also consult regression tests on example usage of the API.

Example implementation

There is an example project for integration with Taxamo and PayPal Express Checkout at, that can be used as a template, regardless if PayPal EC support is needed or not.


If using Maven, just add the following dependency to your module’s pom.xml file:



The file provides example of most common operations - transaction storage, retrieval and confirmation.

import com.taxamo.client.api.TaxamoApi;
import com.taxamo.client.common.ApiException;
import com.taxamo.client.model.*;

import java.math.BigDecimal;
import java.util.Arrays;

public class TaxamoExample {

    public static void main(String[] args) throws ApiException {

        //initialize API object, provide your private token here!
        TaxamoApi api = new TaxamoApi("SamplePrivateTestKey1");

        long t = System.currentTimeMillis();
        CreateTransactionOut createTransactionOut = api.createTransaction(
            new CreateTransactionIn()
                .setTransaction(new InputTransaction()
                                new InputTransactionLine()
                                        .setAmount(new BigDecimal(200))
                                new InputTransactionLine()
                                        .setAmount(new BigDecimal(100))

        //first API call will take longer due to SSL handshake
        String key = createTransactionOut.getTransaction().getKey();
        System.out.println("Created transaction with key: " + key + " in " + 
            (System.currentTimeMillis() - t) + "ms,\n" +
            "Total amount: " + createTransactionOut.getTransaction().getTotalAmount());

        t = System.currentTimeMillis();

        //retrieve transaction details
        GetTransactionOut getTransactionOut = api.getTransaction(key);
        System.out.println("Retrieved transaction in " + (System.currentTimeMillis() - t) + 
            "ms: " + getTransactionOut.getTransaction().getKey());

        t = System.currentTimeMillis();

        //confirm a transaction for it to appear in VAT settlement
        api.confirmTransaction(key, new ConfirmTransactionIn());
        System.out.println("Confirmed transaction with key: " + key + 
            " in " + (System.currentTimeMillis() - t) + "ms");