Sitecore
Avalara plug-in
Amit Patel
Sitecore Architect
XCentium launches Avalara plugin for Sitecore OrderCloud
Taxes made easy
OrderCloud® by four51, now Sitecore OrderCloud®, is a cloud-based offering. Being built on headless architecture and API-first focused design means integrations with 3rd party platforms are pretty flexible and straight-forward. OrderCloud® is designed to be extensible to suit the needs of individual client/project requirements. Xcentium has been a leader in developing extensions and customizations for Sitecore solutions and now for Sitecore OrderCloud®. To this end, Xcentium has developed a plugin for Sitecore OrderCloud® with Avalara, one of industry-leading tax calculation SaaS solution that should be familiar to all types of developers. Avalara’s easy sandbox account creation, tax compliance and extensive documentation make it a perfect choice for integrating with Sitecore OrderCloud®.
Avalara Integration Highlights
- Cloud-based tax calculation system with built-in rate changes assessment.
- Maps OrderCloud cart, line item and address entities to Avalara transactions
- Uses OrderCloud integration events to enable auto tax calculation for cart.
To develop this integration, I had to take care of some prerequisites
- Get a free Avalara Sandbox Account
- Get an OrderCloud Account + populate it with commerce data.
- Create a free ngrok Account
- Fork the OrderCloud Headstart or Catalyst SDK
- If the requirement is to completely separate integration, Catalyst should be used.
Then I performed the following steps,
- First, I installed the Avalara AvaTax SDK on the Catalyst middleware application
- Create a class to configure endpoint and update settings to pass in the license key, end-point URL, and account ID.
- Convert OrderCloud® OrderWorkSheet to AvaTax’s CreateTransactionModel and use the configured class from the step above to create a transaction to get back the total tax amount.
- Note: Avalara/AvaTax checks for address validation. Make sure to supply the correct address.
- Added a Avalara integration project modeled and built out the required functionality
- Avalara config model
- Create Transaction model
- Create Transaction method
- Configured ngrok to route integration event requests to my local machine for testing purposes
- Create an integration event of type OrderCheckout in the Sitecore OrderCloud® portal that calls my middleware service after the order is filled with shipping information.
Testing can also be done through OrderCloud® portal as seen below:
This integration event can also be used to commit, uncommit and void tax transactions in Avalara based on customer requirements.
References: