# Direct sale scenario

Source: https://developer.avalara.com/sales-tax-integration-guide/udi5379158092634/

# Direct sale scenario

Learn how to create sales transactions for direct sales and multi-merchant scenarios.

This scenario shows how to create sales transactions with goods sold direcly by you and with goods sold by 2 different merchants. For example, imagine a scenario where a buyer is purchasing a record player directly from you and 2 vinyl albums from 2 different merchants. For this scenario, the example below creates 3 separate transactions, though the user sees only a single checkout.

Keep in mind that your business model will determine whether you’ll combine the merchant transactions into a single, multi-merchant transaction or whether you’ll create a transaction for each merchant. You should also determine how you’ll handle shipping for this type of transaction. Specifically, will you charge a single, lump sum for shipping across the entire order, or will you charge shipping per vendor?

This scenario assumes the following:

**Transaction 1**

-   This includes a direct sales transaction for a record player.
-   Line 1 `amount` is $200, and the `taxCode` is `P0000000`.
-   The `shipFrom` address from the direct sale is in WA state.
-   The `shipTo` address is in WA state.

-   A flat, non-taxable shipping rate of $5.00 is applied to the direct sales transaction.

**Transaction 2**

-   This includes a sales transaction for a single vinyl record.
-   The `merchantSellerIdentifier` field for this merchant is specified as `Merchant12345`.
-   The `amount` is $25, and the `taxCode` is P0000000.
-   The `shipFrom` address is in WA state.
-   The `shipTo` address is in WA state.
-   No shipping charges are applied to this sales transaction.

**Transaction 3**

-   This includes a sales transaction for a single vinyl record.
-   The `merchantSellerIdentifier` field for this merchant is specified as `Merchant23456`.
-   Line 2 `amount` is $25, and the `taxCode` is `P0000000`.
-   The `shipFrom` address is in CA.
-   The `shipTo` address is in WA state.
-   No shipping charges are applied to this sales transaction.

## Expected result

For the 3 transactions:

-   The total amount for the items should be $250.
-   The total freight should be $5.00.
-   The total tax calculated for the 3 transactions shipping to WA state should be $25.26.
    -   $20.20 tax collected from transaction 1.
    -   $2.53 tax collected from transaction 2.
    -   $2.53 tax collected from transaction 3.

![](https://knowledge-be.avalara.com/bundle/qye3797799319392_qye3797799319392/page/zxv4632726012296.image?_LANG=enus)

## Transaction 1 request

```
{
  "lines": [
    {
      "number":"1",
      "quantity":1,
      "amount":200,
      "taxCode":"P0000000",
      "itemCode":"DSRECPLYR",
      "description":"Direct Sale - Record Player",
      "discounted": false
    },
    {
      "number":"2",
      "quantity":1,
      "amount":5,
      "taxCode":"NT",
      "itemCode":"Freight",
      "description":"Common Carrier for Item 1",
      "discounted": false,
      "ref1": "Freight from Direct Sale"
    }
  ],
  "addresses": {
    "shipFrom":{
      "line1":"100 Ravine Ln NE",
      "city":"Bainbridge Island",
      "region":"WA",
      "country":"US",
      "postalCode":"98110-2687"
    },
    "shipTo":{
      "line1":"1942 Westlake Avenue",
      "city":"Seattle",
      "region":"WA",
      "country":"US",
      "postalCode":"98101"
    }
  },
  "code":"Direct Sale Scenario 1",
  "type":"SalesInvoice",
  "companyCode":"AVALARADEMOSTORE",
  "date":"2024-07-25",
  "customerCode":"Test Customer ID",
  "commit":true,
  "currencyCode":"USD"
}
```

## Transaction 1 response

```
...
  "totalAmount": 205,
  "totalExempt": 5,
  "totalDiscount": 0,
  "totalTax": 20.2,
  "totalTaxable": 200,
  "totalTaxCalculated": 20.2,
...
```

## Transaction 2 request

```
{
  "lines": [
    {
      "number":"1",
      "quantity":1,
      "amount":25,
      "taxCode":"P0000000",
      "itemCode":"MPFVinylRecord",
      "description":"MPF Vinyl Record One",
      "discounted": false,
      "merchantSellerIdentifier": "Merchant12345",
      "addresses": {
        "shipFrom":{
          "line1":"12348 NE 115th Pl",
          "city":"Kirkland",
          "region":"WA",
          "country":"US",
          "postalCode":"98033"
        },
        "shipTo":{
          "line1":"1942 Westlake Avenue",
          "city":"Seattle",
          "region":"WA",
          "country":"US",
          "postalCode":"98101"
        }
      }
    }
  ],
  "code":"Direct Sale Scenario 2",
  "type":"SalesInvoice",
  "companyCode":"DICEYREILLYS",
  "date":"2024-07-25",
  "customerCode":"Test Customer ID",
  "commit":true,
  "currencyCode":"USD",
  "isSellerImporterOfRecord":true
}
```

## Transaction 2 response

```
...
  "totalAmount": 25,
  "totalExempt": 0,
  "totalDiscount": 0,
  "totalTax": 2.53,
  "totalTaxable": 25,
  "totalTaxCalculated": 2.53,
...
```

## Transaction 3 request

```
{
  "lines": [
    {
      "number":"1",
      "quantity":1,
      "amount":25,
      "taxCode":"P0000000",
      "itemCode":"MPFVinylRecord",
      "description":"MPF Vinyl Record Two",
      "discounted": false,
      "merchantSellerIdentifier": "Merchant23456",
      "addresses": {
        "shipFrom":{
          "line1":"145 W Santa Clara St",
          "city":"San Jose",
          "region":"CA",
          "country":"US",
          "postalCode":"95113"
        },
        "shipTo":{
          "line1":"1942 Westlake Avenue",
          "city":"Seattle",
          "region":"WA",
          "country":"US",
          "postalCode":"98101"
        }
      }
    }
  ],
  "code":"Direct Sale Scenario 3",
  "type":"SalesInvoice",
  "companyCode":"DICEYREILLYS",
  "date":"2024-07-25",
  "customerCode":"Test Customer ID",
  "commit":true,
  "currencyCode":"USD",
  "isSellerImporterOfRecord":true
}
```

## Transaction 3 response

```
...
  "totalAmount": 25,
  "totalExempt": 0,
  "totalDiscount": 0,
  "totalTax": 2.53,
  "totalTaxable": 25,
  "totalTaxCalculated": 2.53,
...
```