Package: django-taxtea
TaxTeaDjango app that calculates tax rates for SaaS products :frog: :tea:A little package that goes a long way. Built byMatt StrayerandcontributorsTable of ContentsTable of ContentsPurposeFeaturesInstallationSettingsRequired Accounts & InformationUSPSAvalaraNexusesUsageExampleDocumentationResourcesPurposeTaxes are hard, but that shouldn't stop you from building your dreams. When buildinglowercase, we found out just how hard calculating therightsales tax rate is. TaxTea does the heavy lifting, and tells you exactly what sales tax, if any, you need to charge your customers. So, sit back, sip some tea, and channel your innerKermitbecause tax rates are none of your business...anymore!Currently only supporting US 🇺🇸FeaturesSimple API:Get up & running in minutes.Tax Nexuses, Origin, & Destination Support:The three factors in calculating tax rates. TaxTea handles them all expertly.Up-to-date:No more fear of charging a wrong tax rate. TaxTea is always up to date.Installationpipinstalldjango-taxteaSettingsAdd the following to your Django settings:TAXTEA_USPS_USER="XXXXXXXX"# requiredTAXTEA_AVALARA_USER="XXXXXXXX"# requiredTAXTEA_AVALARA_PASSWORD="XXXXXXXX"# requiredTAXTEA_NEXUSES=[("AZ","12345"),]# requiredTAXTEA_TAX_RATE_INVALIDATE_INTERVAL=7# optional, default is 7 (days)Required Accounts & InformationUSPSTaxTea uses the USPS web service API to find states for Zip Codes. You'll need to register for a free accounthere.NOTE: TaxTea only needs the USPS user, not the password.AvalaraTaxTea relies on Avalara for getting up-to-date tax rates for Zip Codes. The Avalara website can be confusing, but to register simply hit the API endpoint documentedhere.NexusesYourTAXTEA_NEXUSESare any place where your company has a presence. For example, every company has a nexus where they incorporated. We require there to be at least one item in this list, which is your physical incorporation state/zip.Nexuses are part of the equation of how TaxTea calculates sales tax.The determination ofsales tax sourcingis predicated on whether a given state's model for taxation is:Origin-based, orDestination-basedFor example, if your incorporation state is anOrigin-basedstate and a customer purchases your product who also lives in that state, it is the nexus' Zip Code that is used to determine the tax rate, not the customer's location.Destination-basedsales tax means that the sales tax will be charged at the rate of the customer location. This is applicable for out of state transactions and transactions within a state that is not an Origin-based.Want to learn more? Here's a great article aboutOrigin vs. Destination-based Sales taxfrom TaxJar.UsageAdd toINSTALLED_APPS:INSTALLED_APPS=[...,"taxtea"]Run migrations:pythonmanage.pymigrateExampleImport the ZipCode model:fromtaxtea.modelsimportZipCode# Get the ZipCode Object from the database# If no object exists for this Zip Code, it will create one by# fetching data from the USPS API and storing it in the database.# At this point, there will be no `tax_rate` associated with it.zip_code=ZipCode.get("90210")# The `applicable_tax_rate` property is the workhorse of TaxTea.# It will fetch & store a tax rate from the Avalara API and then# use your tax nexuses to determine which tax rate is applicable.tax_rate=zip_code.applicable_tax_rate# Returns a Decimal object that will look like `0.0625`# For convenience, there is a classmethod to convert to a percent.percentage=ZipCode.tax_rate_to_percentage(tax_rate)# Returns a Decimal object that will look like `6.25`DocumentationRead thedocumentation.ResourcesTaxTea uses a list provided by TaxJar to populate the states and their tax collection methods.SaaS Sales TaxOrigin / Destination States