[SOLVED] Avalara for tax rates within CBSubs?

3 years 9 months ago - 3 years 9 months ago #319393 by cpaschen
In the US we need to calculate/collect taxes at the local level for subscriptions for our product/service.
There could be thousands of tax rates that need to be configured - based on the specific location (street/building) of the purchaser.

1) Is there a way to create tax rules based on the specific location (i.e. street address) of the buyer?

2) We have used the Avalara (www.avalara.com) system via API to provide current tax rate data in other extensions. I'm wondering if there is a way to do that (i.e. write a plugin that is triggered at the point of check-out to get the proper tax rate/amount from Avalara via API and add it to the checkout)?

If not,
3) is there a way to import a set of tax rules?

Please Log in to join the conversation.

3 years 9 months ago #319398 by beat
Replied by beat on topic Avalara for tax rates within CBSubs?

cpaschen wrote: In the US we need to calculate/collect taxes at the local level for subscriptions for our product/service.
There could be thousands of tax rates that need to be configured - based on the specific location (street/building) of the purchaser.

1) Is there a way to create tax rules based on the specific location (i.e. street address) of the buyer?


CBSubs Taxes plugin allows you to define Geographic Regions composed of Geographic Zone Entries. Each of these is defined by at least Country, and optionally with State/Province, and as finest grain, a ZIP Code.

Here is how taxes work:

- a Product Plan can get assigned a Tax Rule
- a Tax Rule can get assigned several Tax Rates (e.g. Canada needs multiple ones: country and state taxes apply)
- a Tax Rate defines a tax %, and depends on a Geographic Zone
- a Geographic Zone is comprized of Geographic Zone Entries
- a Geographic Zone Entry is a Country and optionally a Province/State (and sub-optionally a ZIP Code)

This is documented in details in the CBSubs manual.

CBSubs doesn't handle street-level taxes (does any country have street-level taxes?).
All of world's streets would be an insanely huge database...

2) We have used the Avalara (www.avalara.com) system via API to provide current tax rate data in other extensions. I'm wondering if there is a way to do that (i.e. write a plugin that is triggered at the point of check-out to get the proper tax rate/amount from Avalara via API and add it to the checkout)?


CBSubs currently doesn't interface with Avalara, and there are currently no plans to interface with it, as the demand has been inexistant (quick search on our forums leads to 0 results) up to now. I guess, to the best of my knowledge (but this is not legal or fiscal advice, I am not a lawyer nor an accountant nor a business consultant), most immaterial goods sold online remotely without local ties are tax-exempt (except for local sales within the country/state/town of the seller) for SMEs, with the notable exception for sales within EU, and now, above a threshhold, for Switzerland similarly to EU countries too.

However, depending on their API, maybe CB Auto-Action with quite some bit of PHP code can allow you to interface with them. The event is "onCPayBeforeComputeTotalizersPaymentBasketUpdated", and it would require to on the fly add or update the taxes tables depending on the basket invoicing address, so that CB Taxes could then add the corresponding entries. Or to add a taxing line entry to the basket (in SQL table and in PHP structure). But that's not a small task and falls outside of the scope of our support.

A quick research shows this: their API seems documented here: www.avalara.com/us/en/products/integrations/avalara-api.html with a PHP library here: packagist.org/packages/avalara/avataxclient and they have a demo site here: developer.avalara.com/avatax/avatax-demo/

But, there are other solutions, such as taxrates.io/, www.taxjar.com/,

If not,
3) is there a way to import a set of tax rules?


There is no taxes-rules importing function in CBSubs at this time. But you can do that directly into the MySQL database, with e.g. PhpMyAdmin. You would need to populate the corresponding #__cbsubs_tax_rates, #__cbsubs_tax_rules, #__cbsubs_geo_zones, #__cbsubs_geo_zones_entries tables.

I am not aware of an open standard for a tax rates/rules file format, and doing a proprietary tax import in CBSubs wouldn't make sense imho, while PhpMyAdmin allows to import easily into MySQL tables.

Btw, billing and collecting various sales taxes automatically is one thing.
"Guessing" which taxes and rates are applicable, accounting, registering, reporting and returning them is a completely different story.

Billing various sales taxes automatically, depending on the CBSubs taxes configuration, is inside the scope of CBSubs, everything else, including configuring and maintaining the tax rules is outside the scope of CBSubs.

Does that answer/address your questions ? Or do you have further information and urls that would help ?

Beat - Community Builder Team Member

Before posting on forums: Read FAQ thoroughly -- Help us spend more time coding by helping others in this forum, many thanks :)
CB links: Our membership - CBSubs - Templates - Hosting - Forge - Send me a Private Message (PM) only for private/confidential info

Please Log in to join the conversation.

3 years 9 months ago #319403 by cpaschen
Replied by cpaschen on topic Avalara for tax rates within CBSubs?
THANKS for that great response!!!
Very helpful.

In our case we are finding that certain states within the US are 'requiring' taxes on the 'local government' level (esp. county), which is not always defined by a zip code or city name.

The CB Auto-Action route sounds like the best solution for us IF we go this way. We have already done a few somewhat complex auto-action configuration and knowing that "onCPayBeforeComputeTotalizersPaymentBasketUpdated" would be the location where we need to work is very helpful.

Thanks again!

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.190 seconds

Facebook Twitter LinkedIn