# Typical ecommerce transaction workflow

Source: https://developer.avalara.com/vat-ecom/design-the-document-workflow/typical-ecommerce-transaction-workflow/

![ecommerce transaction workflow](https://avalara-devdocs-prod.mcoutput.com/vat-ecom/Resources/Images/DevDot/ecommerce_workflow_816x327.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.