> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # Method name: calculateTax(options: Options, context: Context) # Method package: billingTaxCalculation # Method menu location: billingTaxCalculation --> calculateTax # Method Link: https://dev.wix.com/docs/velo/events-service-plugins/billing/service-plugins/billing-tax-calculation/calculate-tax.md # Method Description: Calculates tax for the provided line items. Tax is calculated for each line item based on the [tax region](https://dev.wix.com/docs/velo/api-reference/wix-billing-v2/tax-regions.md) in `lineItems.taxRegionId` and the [tax group](https://dev.wix.com/docs/velo/api-reference/wix-billing-v2/tax-groups.md) in `lineItems.taxGroupId`. The breakdown of calculated tax returned, includes: + `taxSummary`: The overall total tax calculated. + `lineItemTaxDetails.taxBreakdown`: The tax calculated for each line item in each jurisdiction. + `lineItemTaxDetails.taxSummary`: The total tax calculated for each line item. ### Where to find `calculateTax()` When you [add the Tax Calculation service plugin](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/integrations/custom-extensions-spis/custom-app-extensions-using-sp-is.md#step-1-create-a-new-extension-on-your-wix-site), a folder is automatically added to your site. Use the `.js` file in the folder to write the code to determine how to calculate tax for an order. # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## Example of a `calculateTax()` return value ```javascript export const calculateTax = async (options, context) => { return { "currency": "USD", "taxSummary": { "totalAmount": "170.00", "totalTax": "21.00", "totalTaxableAmount": "170.00", "totalTaxIncludedInPrice": "0.00" }, "lineItemTaxDetails": [{ "_id": "00000000-0000-0000-0000-000000000001", "itemName": "some", "quantity": 1, "taxBreakdown": [{ "jurisdiction": "TEXAS", "jurisdictionType": "STATE", "nonTaxableAmount": "0.00", "rate": "0.20", "taxAmount": "15.00", "taxableAmount": "120.00", "taxType": "Sales", "taxName": "TX STATE TAX" }], "taxSummary": { "fullPrice": "120.00", "taxAmount": "12.00", "taxableAmount": "120.00" } }, { "_id": "shipping", "itemName": "Free Shipping", "quantity": 1, "taxBreakdown": [ { "jurisdiction": "", "nonTaxableAmount": "0", "rate": "0.12", "taxAmount": "6.00", "taxName": "", "taxType": "", "taxableAmount": "50" } ], "taxSummary": { "fullPrice": "50", "taxAmount": "6.00", "taxableAmount": "50.00" } } ] } }; ``` ---