# Multi-merchant scenario

Source: https://developer.avalara.com/marketplace-integration-guide/test-transactions/multi-merchant-scenario/

This scenario is used to show how a user can create a sales transaction with goods sold by two different merchants by specifying shipping addresses at the line level. This scenario assumes the following:

-   The `shipFrom` address from merchant 1 is in WA state.

-   The `merchantSellerIdentifier` field for merchant 1 is specified as `Merchant12345`.

-   The `shipFrom` address from merchant 2 is in CA.

-   The `merchanteSellerIdentifier` field for merchant 2 is specified as `Merchant23456`.

-   The `shipTo` address is in Washington DC, so be sure that your company is configured to collect tax in Washington DC.

-   Line 1 `amount` is $100, and the `taxCode` is `P0000000`.

-   Line 2 `amount` is $10, and the `taxCode` is `FR020100`. This represents freight charges from merchant 1.

-   Line 3 `amount` is $200, and the `taxCode` is `P0000000`.

-   Line 4 `amount` is $10, and the `taxCode` is `FR020100`. This represents freight charges from merchant 2.

## Expected result

The response should show that both items are taxed at the DC state tax rate of 6%. In the UI, you can see that each line has a different Ship From address. In the cURL response, AvaTax assigns IDs to each address. Specifically in this example, AvaTax assigns `4002352421742` for the merchant 1 `shipFrom` and `5001854519726` for the merchant 2 `shipFrom`. (See the document `AddressId` field in the response.)

![Marketplace multi-merchant transaction](https://avalara-devdocs-prod.mcoutput.com/avatax-for-marketplaces/Content/Resources/Images/DevDot/marketplace-multi-merchant-scenario_961x482.png)  

[![Closed](https://avalara-devdocs-prod.mcoutput.com/avatax-for-marketplaces/Content/Skins/Default/Stylesheets/Images/transparent.gif)View request](javascript:void\(0\);)

```
{  "lines": [    {      "number":"1",      "quantity":1,      "amount":100,      "taxCode":"P0000000",      "itemCode":"Test SKU",      "description":"Item 1",      "discounted": false,      "merchantSellerIdentifier": "Merchant12345",      "addresses": {        "shipFrom":{          "line1":"100 Ravine Ln NE",          "city":"Bainbridge Island",          "region":"WA",          "country":"US",          "postalCode":"98110-2687"        },        "shipTo":{          "line1":"915 F St Nw",          "city":"Washington, DC",          "region":"Washington, DC",          "country":"US",          "postalCode":"20004-1493"        }      }    },    {      "number":"2",      "quantity":1,      "amount":10,      "taxCode":"FR020100",      "itemCode":"Freight SKU",      "description":"Common Carrier for Item 1",      "discounted": false,      "ref1": "Freight from Merchant12345",      "addresses": {        "shipFrom":{          "line1":"100 Ravine Ln NE",          "city":"Bainbridge Island",          "region":"WA",          "country":"US",          "postalCode":"98110-2687"        },        "shipTo":{          "line1":"915 F St Nw",          "city":"Washington, DC",          "region":"Washington, DC",          "country":"US",          "postalCode":"20004-1493"        }      }    },    {      "number":"3",      "quantity":2,      "amount":200,      "taxCode":"P0000000",      "itemCode":"Test SKU",      "description":"Item 2",      "discounted": false,      "merchantSellerIdentifier": "Merchant23456",      "addresses": {        "shipFrom":{          "line1":"145 W Santa Clara St",          "city":"San Jose",          "region":"CA",          "country":"US",          "postalCode":"95113"        },        "shipTo":{          "line1":"915 F St Nw",          "city":"Washington, DC",          "region":"Washington, DC",          "country":"US",          "postalCode":"20004-1493"        }      }    },    {      "number":"4",      "quantity":1,      "amount":10,      "taxCode":"FR020100",      "itemCode":"Freight SKU",      "description":"Common Carrier for Item 2",      "discounted": false,      "ref1": "Freight from Merchant23456",      "addresses": {        "shipFrom":{          "line1":"145 W Santa Clara St",          "city":"San Jose",          "region":"CA",          "country":"US",          "postalCode":"95113"        },        "shipTo":{          "line1":"915 F St Nw",          "city":"Washington, DC",          "region":"Washington, DC",          "country":"US",          "postalCode":"20004-1493"        }      }    }  ],  "code":"Certification Test - Multi-merchant",  "type":"SalesInvoice",  "companyCode":"MYCOMPANY",  "date":"2024-07-25",  "customerCode":"Test Customer ID",  "commit":true,  "currencyCode":"USD",  "isSellerImporterOfRecord":true}
```

[![Closed](https://avalara-devdocs-prod.mcoutput.com/avatax-for-marketplaces/Content/Skins/Default/Stylesheets/Images/transparent.gif)View response](javascript:void\(0\);)

```
{  "id": 85061886940146,  "code": "Certification Test - Multi-merchant",  "companyId": 7825858,  "date": "2024-07-25",  "paymentDate": "1900-01-01",  "status": "Committed",  "type": "SalesInvoice",  "batchCode": "",  "currencyCode": "USD",  "exchangeRateCurrencyCode": "USD",  "customerUsageType": "",  "entityUseCode": "",  "customerVendorCode": "Test Customer ID",  "customerCode": "Test Customer ID",  "exemptNo": "",  "reconciled": false,  "locationCode": "",  "reportingLocationCode": "",  "purchaseOrderNo": "",  "referenceCode": "",  "salespersonCode": "",  "taxOverrideType": "None",  "taxOverrideAmount": 0,  "taxOverrideReason": "",  "totalAmount": 320,  "totalExempt": 0,  "totalDiscount": 0,  "totalTax": 19.2,  "totalTaxable": 320,  "totalTaxCalculated": 19.2,  "adjustmentReason": "NotAdjusted",  "adjustmentDescription": "",  "locked": false,  "region": "DC",  "country": "US",  "version": 1,  "softwareVersion": "24.7.0.0",  "originAddressId": -1,  "destinationAddressId": -1,  "exchangeRateEffectiveDate": "2024-07-25",  "exchangeRate": 1,  "isSellerImporterOfRecord": false,  "email": "",  "businessIdentificationNo": "",  "modifiedDate": "2024-07-26T20:08:33.1263546Z",  "modifiedUserId": 1443662,  "taxDate": "2024-07-25",  "lines": [    {      "id": 85061886940151,      "transactionId": 85061886940146,      "lineNumber": "1",      "boundaryOverrideId": 0,      "customerUsageType": "",      "entityUseCode": "",      "description": "Item 1",      "destinationAddressId": 85061886940147,      "originAddressId": 85061886940148,      "discountAmount": 0,      "discountTypeId": 0,      "exemptAmount": 0,      "exemptCertId": 0,      "exemptNo": "",      "isItemTaxable": true,      "isSSTP": false,      "itemCode": "Test SKU",      "lineAmount": 100,      "quantity": 1,      "ref1": "",      "ref2": "",      "reportingDate": "2024-07-25",      "revAccount": "",      "sourcing": "Destination",      "tax": 6,      "taxableAmount": 100,      "taxCalculated": 6,      "taxCode": "P0000000",      "taxCodeId": 8087,      "taxDate": "2024-07-25",      "taxEngine": "",      "taxOverrideType": "None",      "businessIdentificationNo": "",      "taxOverrideAmount": 0,      "taxOverrideReason": "",      "taxIncluded": false,      "merchantSellerIdentifier": "Merchant12345",      "details": [        {          "id": 85061886940158,          "transactionLineId": 85061886940151,          "transactionId": 85061886940146,          "addressId": 85061886940147,          "country": "US",          "region": "DC",          "countyFIPS": "",          "stateFIPS": "11",          "exemptAmount": 0,          "exemptReasonId": 4,          "exemptRuleId": 0,          "inState": false,          "jurisCode": "11",          "jurisName": "DISTRICT OF COLUMBIA",          "jurisdictionId": 14,          "signatureCode": "AKUW",          "stateAssignedNo": "",          "jurisType": "STA",          "jurisdictionType": "State",          "nonTaxableAmount": 0,          "nonTaxableRuleId": 0,          "nonTaxableType": "RateRule",          "rate": 0.06,          "rateRuleId": 1465238,          "rateSourceId": 3,          "serCode": "",          "sourcing": "Destination",          "tax": 6,          "taxableAmount": 100,          "taxType": "Sales",          "taxSubTypeId": "S",          "taxTypeGroupId": "SalesAndUse",          "taxName": "DC STATE TAX",          "taxAuthorityTypeId": 45,          "taxRegionId": 949,          "taxCalculated": 6,          "taxOverride": 0,          "rateType": "General",          "rateTypeCode": "G",          "taxableUnits": 100,          "nonTaxableUnits": 0,          "exemptUnits": 0,          "unitOfBasis": "PerCurrencyUnit",          "isNonPassThru": false,          "isFee": false,          "reportingTaxableUnits": 100,          "reportingNonTaxableUnits": 0,          "reportingExemptUnits": 0,          "reportingTax": 6,          "reportingTaxCalculated": 6,          "liabilityType": "Seller",          "chargedTo": "Buyer"        }      ],      "nonPassthroughDetails": [],      "lineLocationTypes": [        {          "documentLineLocationTypeId": 85061886940156,          "documentLineId": 85061886940151,          "documentAddressId": 85061886940148,          "locationTypeCode": "ShipFrom"        },        {          "documentLineLocationTypeId": 85061886940157,          "documentLineId": 85061886940151,          "documentAddressId": 85061886940147,          "locationTypeCode": "ShipTo"        }      ],      "hsCode": "",      "costInsuranceFreight": 0,      "vatCode": "",      "vatNumberTypeId": 0    },    {      "id": 85061886940152,      "transactionId": 85061886940146,      "lineNumber": "2",      "boundaryOverrideId": 0,      "customerUsageType": "",      "entityUseCode": "",      "description": "Common Carrier for Item 1",      "destinationAddressId": 85061886940147,      "originAddressId": 85061886940148,      "discountAmount": 0,      "discountTypeId": 0,      "exemptAmount": 0,      "exemptCertId": 0,      "exemptNo": "",      "isItemTaxable": true,      "isSSTP": false,      "itemCode": "Freight SKU",      "lineAmount": 10,      "quantity": 1,      "ref1": "Freight from Merchant12345",      "ref2": "",      "reportingDate": "2024-07-25",      "revAccount": "",      "sourcing": "Destination",      "tax": 0.6,      "taxableAmount": 10,      "taxCalculated": 0.6,      "taxCode": "FR020100",      "taxCodeId": 8555,      "taxDate": "2024-07-25",      "taxEngine": "",      "taxOverrideType": "None",      "businessIdentificationNo": "",      "taxOverrideAmount": 0,      "taxOverrideReason": "",      "taxIncluded": false,      "details": [        {          "id": 85061886940162,          "transactionLineId": 85061886940152,          "transactionId": 85061886940146,          "addressId": 85061886940147,          "country": "US",          "region": "DC",          "countyFIPS": "",          "stateFIPS": "11",          "exemptAmount": 0,          "exemptReasonId": 4,          "exemptRuleId": 0,          "inState": false,          "jurisCode": "11",          "jurisName": "DISTRICT OF COLUMBIA",          "jurisdictionId": 14,          "signatureCode": "AKUW",          "stateAssignedNo": "",          "jurisType": "STA",          "jurisdictionType": "State",          "nonTaxableAmount": 0,          "nonTaxableRuleId": 0,          "nonTaxableType": "RateRule",          "rate": 0.06,          "rateRuleId": 1465238,          "rateSourceId": 3,          "serCode": "",          "sourcing": "Destination",          "tax": 0.6,          "taxableAmount": 10,          "taxType": "Sales",          "taxSubTypeId": "S",          "taxTypeGroupId": "SalesAndUse",          "taxName": "DC STATE TAX",          "taxAuthorityTypeId": 45,          "taxRegionId": 949,          "taxCalculated": 0.6,          "taxOverride": 0,          "rateType": "General",          "rateTypeCode": "G",          "taxableUnits": 10,          "nonTaxableUnits": 0,          "exemptUnits": 0,          "unitOfBasis": "PerCurrencyUnit",          "isNonPassThru": false,          "isFee": false,          "reportingTaxableUnits": 10,          "reportingNonTaxableUnits": 0,          "reportingExemptUnits": 0,          "reportingTax": 0.6,          "reportingTaxCalculated": 0.6,          "liabilityType": "Seller",          "chargedTo": "Buyer"        }      ],      "nonPassthroughDetails": [],      "lineLocationTypes": [        {          "documentLineLocationTypeId": 85061886940160,          "documentLineId": 85061886940152,          "documentAddressId": 85061886940148,          "locationTypeCode": "ShipFrom"        },        {          "documentLineLocationTypeId": 85061886940161,          "documentLineId": 85061886940152,          "documentAddressId": 85061886940147,          "locationTypeCode": "ShipTo"        }      ],      "hsCode": "",      "costInsuranceFreight": 0,      "vatCode": "",      "vatNumberTypeId": 0    },    {      "id": 85061886940153,      "transactionId": 85061886940146,      "lineNumber": "3",      "boundaryOverrideId": 0,      "customerUsageType": "",      "entityUseCode": "",      "description": "Item 2",      "destinationAddressId": 85061886940147,      "originAddressId": 85061886940149,      "discountAmount": 0,      "discountTypeId": 0,      "exemptAmount": 0,      "exemptCertId": 0,      "exemptNo": "",      "isItemTaxable": true,      "isSSTP": false,      "itemCode": "Test SKU",      "lineAmount": 200,      "quantity": 2,      "ref1": "",      "ref2": "",      "reportingDate": "2024-07-25",      "revAccount": "",      "sourcing": "Destination",      "tax": 12,      "taxableAmount": 200,      "taxCalculated": 12,      "taxCode": "P0000000",      "taxCodeId": 8087,      "taxDate": "2024-07-25",      "taxEngine": "",      "taxOverrideType": "None",      "businessIdentificationNo": "",      "taxOverrideAmount": 0,      "taxOverrideReason": "",      "taxIncluded": false,      "merchantSellerIdentifier": "Merchant23456",      "details": [        {          "id": 85061886940169,          "transactionLineId": 85061886940153,          "transactionId": 85061886940146,          "addressId": 85061886940147,          "country": "US",          "region": "DC",          "countyFIPS": "",          "stateFIPS": "11",          "exemptAmount": 0,          "exemptReasonId": 4,          "exemptRuleId": 0,          "inState": false,          "jurisCode": "11",          "jurisName": "DISTRICT OF COLUMBIA",          "jurisdictionId": 14,          "signatureCode": "AKUW",          "stateAssignedNo": "",          "jurisType": "STA",          "jurisdictionType": "State",          "nonTaxableAmount": 0,          "nonTaxableRuleId": 0,          "nonTaxableType": "RateRule",          "rate": 0.06,          "rateRuleId": 1465238,          "rateSourceId": 3,          "serCode": "",          "sourcing": "Destination",          "tax": 12,          "taxableAmount": 200,          "taxType": "Sales",          "taxSubTypeId": "S",          "taxTypeGroupId": "SalesAndUse",          "taxName": "DC STATE TAX",          "taxAuthorityTypeId": 45,          "taxRegionId": 949,          "taxCalculated": 12,          "taxOverride": 0,          "rateType": "General",          "rateTypeCode": "G",          "taxableUnits": 200,          "nonTaxableUnits": 0,          "exemptUnits": 0,          "unitOfBasis": "PerCurrencyUnit",          "isNonPassThru": false,          "isFee": false,          "reportingTaxableUnits": 200,          "reportingNonTaxableUnits": 0,          "reportingExemptUnits": 0,          "reportingTax": 12,          "reportingTaxCalculated": 12,          "liabilityType": "Seller",          "chargedTo": "Buyer"        }      ],      "nonPassthroughDetails": [],      "lineLocationTypes": [        {          "documentLineLocationTypeId": 85061886940164,          "documentLineId": 85061886940153,          "documentAddressId": 85061886940149,          "locationTypeCode": "ShipFrom"        },        {          "documentLineLocationTypeId": 85061886940165,          "documentLineId": 85061886940153,          "documentAddressId": 85061886940147,          "locationTypeCode": "ShipTo"        }      ],      "hsCode": "",      "costInsuranceFreight": 0,      "vatCode": "",      "vatNumberTypeId": 0    },    {      "id": 85061886940154,      "transactionId": 85061886940146,      "lineNumber": "4",      "boundaryOverrideId": 0,      "customerUsageType": "",      "entityUseCode": "",      "description": "Common Carrier for Item 2",      "destinationAddressId": 85061886940147,      "originAddressId": 85061886940149,      "discountAmount": 0,      "discountTypeId": 0,      "exemptAmount": 0,      "exemptCertId": 0,      "exemptNo": "",      "isItemTaxable": true,      "isSSTP": false,      "itemCode": "Freight SKU",      "lineAmount": 10,      "quantity": 1,      "ref1": "Freight from Merchant23456",      "ref2": "",      "reportingDate": "2024-07-25",      "revAccount": "",      "sourcing": "Destination",      "tax": 0.6,      "taxableAmount": 10,      "taxCalculated": 0.6,      "taxCode": "FR020100",      "taxCodeId": 8555,      "taxDate": "2024-07-25",      "taxEngine": "",      "taxOverrideType": "None",      "businessIdentificationNo": "",      "taxOverrideAmount": 0,      "taxOverrideReason": "",      "taxIncluded": false,      "details": [        {          "id": 85061886940176,          "transactionLineId": 85061886940154,          "transactionId": 85061886940146,          "addressId": 85061886940147,          "country": "US",          "region": "DC",          "countyFIPS": "",          "stateFIPS": "11",          "exemptAmount": 0,          "exemptReasonId": 4,          "exemptRuleId": 0,          "inState": false,          "jurisCode": "11",          "jurisName": "DISTRICT OF COLUMBIA",          "jurisdictionId": 14,          "signatureCode": "AKUW",          "stateAssignedNo": "",          "jurisType": "STA",          "jurisdictionType": "State",          "nonTaxableAmount": 0,          "nonTaxableRuleId": 0,          "nonTaxableType": "RateRule",          "rate": 0.06,          "rateRuleId": 1465238,          "rateSourceId": 3,          "serCode": "",          "sourcing": "Destination",          "tax": 0.6,          "taxableAmount": 10,          "taxType": "Sales",          "taxSubTypeId": "S",          "taxTypeGroupId": "SalesAndUse",          "taxName": "DC STATE TAX",          "taxAuthorityTypeId": 45,          "taxRegionId": 949,          "taxCalculated": 0.6,          "taxOverride": 0,          "rateType": "General",          "rateTypeCode": "G",          "taxableUnits": 10,          "nonTaxableUnits": 0,          "exemptUnits": 0,          "unitOfBasis": "PerCurrencyUnit",          "isNonPassThru": false,          "isFee": false,          "reportingTaxableUnits": 10,          "reportingNonTaxableUnits": 0,          "reportingExemptUnits": 0,          "reportingTax": 0.6,          "reportingTaxCalculated": 0.6,          "liabilityType": "Seller",          "chargedTo": "Buyer"        }      ],      "nonPassthroughDetails": [],      "lineLocationTypes": [        {          "documentLineLocationTypeId": 85061886940171,          "documentLineId": 85061886940154,          "documentAddressId": 85061886940149,          "locationTypeCode": "ShipFrom"        },        {          "documentLineLocationTypeId": 85061886940172,          "documentLineId": 85061886940154,          "documentAddressId": 85061886940147,          "locationTypeCode": "ShipTo"        }      ],      "hsCode": "",      "costInsuranceFreight": 0,      "vatCode": "",      "vatNumberTypeId": 0    }  ],  "addresses": [    {      "id": 85061886940147,      "transactionId": 85061886940146,      "boundaryLevel": "Address",      "line1": "915 F St Nw",      "line2": "",      "line3": "",      "city": "Washington",      "region": "DC",      "postalCode": "20004-1493",      "country": "US",      "taxRegionId": 949,      "latitude": "38.897411",      "longitude": "-77.02471"    },    {      "id": 85061886940148,      "transactionId": 85061886940146,      "boundaryLevel": "Address",      "line1": "100 Ravine Ln Ne",      "line2": "",      "line3": "",      "city": "Bainbridge Island",      "region": "WA",      "postalCode": "98110-2687",      "country": "US",      "taxRegionId": 2109716,      "latitude": "47.624808",      "longitude": "-122.515193"    },    {      "id": 85061886940149,      "transactionId": 85061886940146,      "boundaryLevel": "Address",      "line1": "145 W Santa Clara St",      "line2": "",      "line3": "",      "city": "San Jose",      "region": "CA",      "postalCode": "95113-1705",      "country": "US",      "taxRegionId": 4017208,      "latitude": "37.335162",      "longitude": "-121.892838"    }  ],  "locationTypes": [],  "summary": [    {      "country": "US",      "region": "DC",      "jurisType": "State",      "jurisCode": "11",      "jurisName": "DISTRICT OF COLUMBIA",      "taxAuthorityType": 45,      "stateAssignedNo": "",      "taxType": "Sales",      "taxSubType": "S",      "taxName": "DC STATE TAX",      "rateType": "General",      "taxable": 320,      "rate": 0.06,      "tax": 19.2,      "taxCalculated": 19.2,      "nonTaxable": 0,      "exemption": 0    }  ],  "apStatusCode": null,  "apStatus": null}
```