Calculate Tax

Use this request to calculate tax without storing the results.

To calculate tax for a transaction, use the following URL and the POST method:

{service_url}/api/v3/marketplace/tax/calculate

Here, {service_url} is the URL of the sandbox or production environment.

Example:

https://marketplace-api.sandbox.marketplace.taxamo.com/api/v3/marketplace/tax/calculate

Details

EndpointMethod
/api/v3/marketplace/tax/calculatePOST

Fields

For more information, see Marketplace Transaction Fields Reference.

Request example

The following example calculates the tax amount and assigns tax liability at the transaction line level.

The shopping cart contains two physical goods shipped to Bath, England:

  • A €200 physical item sold by the EU-based seller EU1M and shipped from China. The item has the Combined Nomenclature (CN) code 8504 31 80 15.
  • A €100 physical item sold by the China-based seller CN1M and shipped from Poland. The item has the same CN code, 8504 31 80 15.

The first item has tax liability assigned to the buyer, so no tax is added to the transaction. The second item has tax liability assigned to the platform.

curl --request POST \
  --url https://marketplace-api.sandbox.marketplace.taxamo.com/api/v3/marketplace/tax/calculate \
  --header 'content-type: application/json' \
  --header "x-marketplace-token: $TOKEN" \
  --data '{
	"transaction": {
		"currency_code": "EUR",
		"buyer_name": "Scenario #1 buyer",
    "invoice_timestamp": "2020-05-20T01:59:59+04:00",
		"ship_to_address": {
			"street_name": "30 Monmouth Street",
			"city": "Bath",
			"postal_code": "BA1 2AP",
			"country_code": "GB"
		},   
		"description": "Example sale to GB.",
		"transaction_lines": [
			{
        "seller_code": "EU1M",
				"custom_id": "line_1",
				"amount": 150,
				"ship_from_address": {"country_code": "CN"},
				"product_class": "P",
				
				"description": "Goods #1",				
				"parcel_reference": "3897329872423",
				"carrier_id": "DHL",
        "product_cn_code": "8504 31 80 15",
        "product_reference_number": ""
        
        
			}, 
    {
        "seller_code": "CN1M",
				"custom_id": "line_2",
				"amount": 100,
				"ship_from_address": {"country_code": "PL"},
				"product_class": "P",
				
				"description": "Goods #2",				
				"parcel_reference": "3897329872423",
				"carrier_id": "DHL",
        "product_cn_code": "8504 31 80 15",
        "product_reference_number": ""
        
        
    }]
	}
}'

Response example

The request returns the following response:

{
   "transaction" : {
      "countries" : {},
      "required_fields" : {
         "tax_required_fields" : [],
         "audit_required_fields" : [],
         "storage_required_fields" : []
      },
      "ship_to_address" : {
         "country_code" : "GB",
         "postal_code" : "BA1 2AP",
         "street_name" : "30 Monmouth Street",
         "city" : "Bath"
      },
      "amount" : 250,
      "tax_country_codes" : "GB",
      "tax_amount" : 20,
      "transaction_lines" : [
         {
            "deducted_tax_rate" : 0,
            "quantity" : 1,
            "product_class" : "P",
            "tax_number_service" : "vies",
            "tax_address_kind" : "ship-to-address",
            "carrier_id" : "DHL",
            "tax_country_code" : "GB",
            "tax_supported" : true,
            "tax_engine" : "taxamo",
            "custom_id" : "line_1",
            "tax_region" : "EU",
            "description" : "Goods #1",
            "tax_entity_name" : "United Kingdom",
            "tax_liability_rule" : "physical-shipment-into-EU-goods-above-150-eur",
            "total_amount" : 150,
            "unit_price" : 150,
            "tax_liability_owner_code" : "buyer",
            "taxes" : [],
            "line_key" : "FXespKi7SifDDEuh",
            "line_num" : 1,
            "kind" : "b2c",
            "product_cn_code" : "8504 31 80 15",
            "parcel_reference" : "3897329872423",
            "reverse_charge" : false,
            "ship_from_address" : {
               "country_code" : "CN"
            },
            "product_reference_number" : "",
            "seller_code" : "EU1M",
            "amount" : 150,
            "deducted_tax_amount" : 0
         },
         {
            "line_key" : "jIZ2xhTg41ezIcwX",
            "taxes" : [
               {
                  "rate" : 20,
                  "rate_type" : "Standard",
                  "tax_name" : "European VAT physical",
                  "amount_fraction_taxable" : 1
               }
            ],
            "line_num" : 2,
            "kind" : "b2c",
            "back_to_back_invoice_country_code" : "PL",
            "product_cn_code" : "8504 31 80 15",
            "reverse_charge" : false,
            "ship_from_address" : {
               "country_code" : "PL"
            },
            "seller_code" : "CN1M",
            "product_reference_number" : "",
            "parcel_reference" : "3897329872423",
            "amount" : 100,
            "tax_amount" : 20,
            "quantity" : 1,
            "product_class" : "P",
            "tax_country_code" : "GB",
            "carrier_id" : "DHL",
            "tax_supported" : true,
            "tax_address_kind" : "ship-to-address",
            "tax_number_service" : "vies",
            "tax_engine" : "taxamo",
            "custom_id" : "line_2",
            "tax_region" : "EU",
            "total_amount" : 120,
            "tax_liability_rule" : "physical-shipment-inside-EU-seller-outside-EU",
            "unit_price" : 100,
            "tax_liability_owner_code" : "P1",
            "tax_entity_name" : "United Kingdom",
            "description" : "Goods #2"
         }
      ],
      "invoice_address" : {
         "city" : "Bath",
         "postal_code" : "BA1 2AP",
         "street_name" : "30 Monmouth Street",
         "country_code" : "GB"
      },
      "currency_code" : "EUR",
      "invoice_timestamp" : "2020-05-20T01:59:59+04:00",
      "product_classes" : "P",
      "buyer_name" : "Scenario #1 buyer",
      "total_amount" : 270,
      "description" : "Example sale to GB.",
      "tax_liability_owner_codes" : "buyer,P1",
      "location_evidence" : {}
   }
}

Did this page help you?