Comments (15)
Not a simple topic, let's dig in deeper.
Kinds of Taxes
I think there are only two kinds that come up for e-commerce: VAT or sales tax, and customs.
While there are many accounting and legal differences between VAT and sales tax, for the purpose of a sales platform like OCC they behave identically, as a percentage cost added to the line item. It's typically a single rate, but some product classes (e.g. essential food or hygiene goods) may have different rates. Though unless you are extremely sure, just use the full rate. In e-commerce the tax is paid according to the purchaser's country/state or origin.
(Customs depend on the source and destination countries too. Local orders, or orders within a customs-union (e.g. the Schengen Zone in Europe or MERCOSUR in South-America) suffer no customs and many countries waive customs on small value shipments. For the rest, it's incredibly complicated with individual line item classes, the total value, and possibly various treaties can affect the result. Luckily customs is the importer's responsibility. While bigger sites offer informative estimates, it's not a requirement.)
Generic Implementation
As a general solution I think we should have an event, something like PreparingCartForCheckout
that gets the ShoppingCartItem
collection and updates it. There the line items could be updated individually, in an extensible way. (The same event could be useful for shipping too to add a shipping cost entry.) When accessing the cart this even would be triggered before returning the items.
I'm unsure how we should express the tax on line items. Another question is if the prices should be net or gross. As I understand, in the USA it's typical to show net prices. This is also common in VAT-using countries for shops that primarily sell to other businesses (for VAT write-off reasons).
I think we have to bite the bullet and replace Money.Amount.Value
with separate NetValue
and GrossValue
properties, to avoid potentially costly confusion. Then choosing which to display would be a matter of configuration. What do you think? Additionally we should have a string TaxName
property, it would be important in the future if we need invoice integration.
Default VAT Implementation
This heavily depends on the above, but it should be flexible because these rates do change as legislation evolves (so don't use pre-calculated tax rate tables).
As a start, we should add a feature that represents a local VAT implementation, with an admin menu where you can pick a single percentage. Then it would just apply it from the above mentioned event. This is enough if you only sell domestically.
A different feature for or international orders, we might need to use a VAT API that gets the current and up-to-date numbers. I'm not aware of a reliable free API for that. If anyone has need or preference for this in the MVP, please speak up!
Nothing is Set in Stone
This is just my recommendation, please chime in if I missed something crucial. Please don't start working on the issue until we have heard some other voices on the topic.
from orchardcore.commerce.
Luckily customs is the importer's responsibility
I agree.
As a start, we should add a feature that represents a local VAT implementation, with an admin menu where you can pick a single percentage.
Here in Quebec we have 2 sales taxes. We have one that is federal HST (harmonized sales tax) and one that is provincial QST (Quebec sales tax). This means that it is a compound tax that needs to be calculated in the right order.
http://www.calculconversion.com/sales-tax-calculator-gst-qst.html
Here you can see how it is calculated. So, I believe that taxes should be based on some rules. Maybe looking into some known e-commerce platform could help find how it should be integrated.
from orchardcore.commerce.
Based on the linked tax calculator (from OCC's perspective) boils down to a 114.975% sales tax that applies to a region instead of the whole country. Do you have to pay QST if you import something into Quebec or just for local sales?
from orchardcore.commerce.
Anyway, you make a good point about looking at some other e-commerce platforms. I will look into it soon. In the meantime if anyone can point me to specific relevant parts in an open source e-commerce project, please don't hesitate.
from orchardcore.commerce.
from orchardcore.commerce.
QST is for local sales but as you can see it is also charged by Newegg.ca
It always depends if you need to produce a tax report for that country/state and I believe that it is now encouraged.
GST(HST) = Goods and service tax (Harmonized sales tax) = VAT (Value added tax)
PST(QST) = Provincial sales tax (Quebec sales tax)
As you can see here they always have 2 taxes which are defined by GST and PST.
And I believe that some States in the USA also have city taxes and special jurisdiction taxes.
from orchardcore.commerce.
+1 for Avalara but you also need a simple table solution for small websites.
https://github.com/avadev/AvaTax-REST-V2-DotNet-SDK
from orchardcore.commerce.
from orchardcore.commerce.
from orchardcore.commerce.
from orchardcore.commerce.
I believe that big e-commerce companies have been recently encouraged to pay sales tax in different countries at least (Amazon). So, while a state cannot require it we still need to take it into consideration. Also, at that point, you would surely be using Avalara.
from orchardcore.commerce.
As a reference point, here are some pointers to the Nwazet implementation, which was built for a US business frequently shipping overseas:
- https://github.com/bleroy/Nwazet.Commerce/blob/master/Services/ITax.cs
- https://github.com/bleroy/Nwazet.Commerce/blob/master/Services/ITaxProvider.cs
- https://github.com/bleroy/Nwazet.Commerce/blob/master/Services/ZipCodeTaxProvider.cs
- https://github.com/bleroy/Nwazet.Commerce/blob/master/Models/ZipCodeTaxPart.cs
- https://github.com/bleroy/Nwazet.Commerce/blob/master/Services/StateOrCountryTaxProvider.cs
- https://github.com/bleroy/Nwazet.Commerce/blob/master/Models/StateOrCountryTaxPart.cs
It relies heavily on the model of geography:
- https://github.com/bleroy/Nwazet.Commerce/blob/master/Services/ITerritoriesService.cs
- https://github.com/bleroy/Nwazet.Commerce/blob/master/Services/TerritoriesService.cs
- https://github.com/bleroy/Nwazet.Commerce/blob/master/Services/ITerritoriesHierarchyService.cs
- https://github.com/bleroy/Nwazet.Commerce/blob/master/Services/TerritoriesHierarchyService.cs
- https://github.com/bleroy/Nwazet.Commerce/blob/master/Services/UnitedStates.cs
from orchardcore.commerce.
Avalara looks very interesting. Also I see an alternative, TaxJar (a Stripe company). Both have NuGet libraries. In either case you need full source and destination address, and line items with prices and tax codes. I guess the tax code would be the one you use for the product domestically, because how on earth would you know/maintain all the different tax codes for every country? We could add an optional field in ProductPart
to store the product's tax code. As for the source address, that could be a site setting. So these are the info we should include in the abstraction (the equivalent of ITax
in Nwazet) to cover every implementation. The result would be a collection of tax name and amount pairs. It has to be for each line item, because applying tax on just the total is not allowed everywhere.
As for the implementation without an external service, we could do something similar to the ZipCodeTaxPart.Rates, but use the whole address and the tax code to match against (either as a table of regex expressions or perhaps create a DSL with Irony). Then every item that matches would be applied.
from orchardcore.commerce.
Probably shouldn't use ProductPart
, which is deliberately minimalist in terms of concerns it addresses. There should be a separate part that encapsulates tax concerns and only that.
from orchardcore.commerce.
Good point, I agree.
from orchardcore.commerce.
Related Issues (20)
- Catalog navigation and Search (OCC-192) HOT 4
- Upgrade to Orchard Core 1.9 once it's released and remove Newtonsoft.Json from the code base (OCC-194) HOT 3
- Boolean product attributes not stored in the order screen. (OCC-195) HOT 1
- Product Attributes should display the field label or name instead in cart and order display (OCC-196)
- Cloudsmith publishing is broken (OCC-197) HOT 1
- Prevent checking out if there are unavailable products in the cart (OCC-199) HOT 4
- Integrate exactly payments for EU/UK merchants (OCC-203)
- Have a new community survey (OCC-204) HOT 1
- make class Address partial (OCC-205) HOT 13
- OrchardCore.Commerce.Tests.UI.Shortcuts NuGet misses metadata (OCC-207)
- Checkout exception if the Billing/ShippingAddressFieldEditor shapes are not present (OCC-208)
- The File Content Definition not generate ContentDefinition.json (OCC-213)
- CreateOrderLineItemsAsync does not take care of product discounts (OCC-214) HOT 1
- I have Created a new price variants product content item, but it couldn't display variants inventories. (OCC-217)
- Running FullSecurityScanShouldPass locally fails (OCC-218) HOT 5
- When Creating a new Product Content Item in BagPart, ProductPartIndex don't update. (OCC-220) HOT 1
- Multiple payment intents are created during a single session (OCC-221)
- Aggregating multiple products into a new product that has indepdent unit price,inventory, attributes and SKU, and can be sold indepdently. (OCC-222) HOT 2
- Upgrade to Orchard Core 1.8 (OCC-223) HOT 13
- Ambiguous HTTP methods (OCC-225)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from orchardcore.commerce.