Back to Medusa

getProvider - Tax Module Reference

www/apps/resources/references/tax/ITaxModuleService/methods/tax.ITaxModuleService.getProvider/page.mdx

2.14.22.0 KB
Original Source

import { TypeList } from "docs-ui"

getProvider - Tax Module Reference

This documentation provides a reference to the getProvider method. This belongs to the Tax Module.

<Note>

You should only use this methods when implementing complex customizations. For common cases, check out available workflows instead.

</Note>

This method returns the service of a Tax Module Provider by its ID. A Tax Module Provider's ID is of the format tp_{identifier}_{id}, where identifier is the static identifier property defined in the provider's service, and id is the ID set in medusa-config.ts when registering the provider.

Example

ts
const avalaraProvider = taxModuleService.getProvider("tp_avalara_avalara")
// TODO: perform custom actions with the provider

Parameters

<TypeList types={[{"name":"providerId","type":"string","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="getProvider"/>

Returns

<TypeList types={[{"name":"getIdentifier","type":"() => string","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"getTaxLines","type":"(itemLines: ItemTaxCalculationLine[], shippingLines: ShippingTaxCalculationLine[], context: TaxCalculationContext) => Promise<(ItemTaxLineDTO \| ShippingTaxLineDTO)[]>","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="getProvider"/>