Tax Code Module
In this section of the documentation, you will find resources to learn more about the Tax Code Module and how to use it in your application. Mercur has tax code management features available out-of-the-box through the Tax Code Module. A module is a standalone package that provides features for a single domain. Each of Mercur’s marketplace features are placed in custom modules, such as this Tax Code Module. Learn more about why modules are isolated in this documentation.Tax Code Features
- Tax Code Storage: Store standardized tax classification codes for products and categories.
- Stripe Integration: Fetch and sync tax codes from Stripe’s Tax Code API.
- Category Association: Link tax codes to product categories for automatic tax classification.
- Tax Compliance: Enable proper tax calculation based on product type and jurisdiction.
How to Use the Tax Code Module
The Tax Code Module provides a service method to sync tax codes from Stripe:Concepts
In this document, you’ll learn about the main concepts related to tax codes in Mercur.Tax Code
A tax code is a standardized classification code used for tax calculation and compliance. It is represented by the TaxCode data model. A tax code holds information about:- A unique code identifier (e.g.,
txcd_00000000for general goods) - A human-readable name
- A description explaining what products fall under this code
- Created and updated timestamps
- Stripe tax codes
- HS (Harmonized System) codes for customs
- Product tax categories for sales tax
Stripe Tax Code Integration
The Tax Code Module includes integration with Stripe’s tax code system through thegetTaxCodes() method.
How It Works
- Module connects to Stripe API using configured API key
- Fetches tax codes in batches of 100 (Stripe’s limit)
- Automatically paginates through all available tax codes
- Returns complete array of Stripe tax code objects
Category-Level Tax Classification
Tax codes can be associated with product categories through module links: ProductCategory → TaxCode (many-to-one) This enables:- Automatic tax classification for products in a category
- Consistent tax handling across similar products
- Simplified tax configuration (set once per category vs per product)
- “Electronics” category →
txcd_10200000(Electronic equipment) - “Clothing” category →
txcd_20010000(Clothing) - “Books” category →
txcd_10000000(Books)
Tax Code vs Tax Rate
It’s important to distinguish between tax codes and tax rates: Tax Code (This module):- Classification code for product type
- Determines which tax rules apply
- Managed in Tax Code Module
- Example: “txcd_20010000” (Clothing)
- Percentage amount to charge
- Varies by jurisdiction
- Managed in Tax Module
- Example: 8.5% sales tax for California