TaxEngineAdapter Example Implementation
Refer to the example implementation of the TaxEngineAdapter interface to accept information from a tax engine and evaluate the information to define tax details.
See commercetax namespace to view the list of available classes.
The TaxEngineAdapter interface accepts information from the tax engine through the TaxEngineContext class. The interface evaluates the information to define tax in the response with details, such as tax amount and addresses. The response is used to update and create entities in the Salesforce org.
From Winter ’26, the available state and country values from orgs that are configured with State and Country/Territory Picklists are also supported.
Use these steps to build a sample tax adapter implementation. Each tax adapter implementation varies based on your implementation requirements. Customize this example to suit your business requirements.
See Tax Engine Reference Gateway Adapter for reference implementations of a tax engine adapter.
-
Get the tax rates from the created custom object. See TaxEngineAdapter Interface.
-
The custom adapter class implements the
TaxEngineAdapterinterface. TheprocessRequestmethod takes an instance ofTaxEngineContextclass and returns a response with the calculated tax details through theTaxDetailsResponseclass or an error response through theErrorResponseclass. -
Select
StandardTaxAdapteras the provider when you create a tax engine record in your org.