# Marketplace workflow where the marketplace collects and pays tax everywhere

Source: https://developer.avalara.com/marketplace-integration-guide/design-the-document-workflow/workflow-marketplace-everywhere/

The image below describes a typical transaction workflow for marketplaces configured to collect and pay tax everywhere. Be sure you have native reporting capabilities for individual merchants on your platform to provide them with revenue. Also provide merchants with the capability to calculate and self-asses vendor tax collection jurisdictions (Nexus).

![Marketplace workflow, where the marketplace collects and pays everywhere](https://avalara-devdocs-prod.mcoutput.com/avatax-for-marketplaces/Content/Resources/Images/DevDot/ecommerce_workflow_723x290.png)  

When your customer opens a shopping cart and puts an item in it, call the [CreateTransaction API](https://developer.avalara.com/api-reference/avatax/rest/v2/methods/Transactions/CreateTransaction/) with `type` set to `SalesOrder`. This return a tax calculation based on your shipping address and the customer’s destination address. For sales orders, AvaTax won't record a permanent transaction, so you won’t have to do any cleanup for abandoned carts.

When the customer finalizes the order, call `CreateTransaction` again with `type` set to `SalesInvoice`. AvaTax will record this transaction and allow you to fetch it back later with the [GetTransaction API](https://developer.avalara.com/api-reference/avatax/rest/v2/methods/Transactions/GetTransactionByCodeAndType/).

When your order ships, call the [CommitTransaction API](https://developer.avalara.com/api-reference/avatax/rest/v2/methods/Transactions/CommitTransaction/) to mark the transaction as committed. This prevents accidental changes to the transaction. Also, if your customer uses [Avalara’s Managed Returns Service](https://www.avalara.com/us/en/products/sales-and-use-tax/returns.html), this allows our team to file your sales tax return.

**Advice**:  
Filter on the merchant ID using the `merchantSellerIdentifier` field in the [LineItemModel](https://developer.avalara.com/api-reference/avatax/rest/v2/models/LineItemModel/), for example: `"merchantSellerIdentifier":"Merchant12345"`. In addition, marketplaces should also be aware of the [InitiateExportDocumentLineReport](https://developer.avalara.com/api-reference/avatax/rest/v2/methods/Reports/InitiateExportDocumentLineReport/) API.