Coder Social home page Coder Social logo

Comments (15)

sarahelsaig avatar sarahelsaig commented on June 23, 2024

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.

Skrypt avatar Skrypt commented on June 23, 2024

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.

sarahelsaig avatar sarahelsaig commented on June 23, 2024

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.

sarahelsaig avatar sarahelsaig commented on June 23, 2024

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.

UR-ScottShew avatar UR-ScottShew commented on June 23, 2024

from orchardcore.commerce.

Skrypt avatar Skrypt commented on June 23, 2024

QST is for local sales but as you can see it is also charged by Newegg.ca

image

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.

Skrypt avatar Skrypt commented on June 23, 2024

+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.

UR-ScottShew avatar UR-ScottShew commented on June 23, 2024

from orchardcore.commerce.

UR-ScottShew avatar UR-ScottShew commented on June 23, 2024

from orchardcore.commerce.

UR-ScottShew avatar UR-ScottShew commented on June 23, 2024

from orchardcore.commerce.

Skrypt avatar Skrypt commented on June 23, 2024

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.

bleroy avatar bleroy commented on June 23, 2024

As a reference point, here are some pointers to the Nwazet implementation, which was built for a US business frequently shipping overseas:

It relies heavily on the model of geography:

from orchardcore.commerce.

sarahelsaig avatar sarahelsaig commented on June 23, 2024

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.

bleroy avatar bleroy commented on June 23, 2024

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.

sarahelsaig avatar sarahelsaig commented on June 23, 2024

Good point, I agree.

from orchardcore.commerce.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.