> ## Documentation Index
> Fetch the complete documentation index at: https://docs.crossmint.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Item Selection

> Specify which items to purchase with Headless Checkout API

The Headless Checkout API allows you to specify which items your users can purchase using the `lineItems` property. This guide explains how to configure item selection for different asset types.

<Snippet file="item-selection-common.mdx" />

## JSON Item Selection Examples

<CodeGroup>
  ```json collectionLocator theme={null}
  {
    "lineItems": [
      {
        "collectionLocator": "crossmint:_YOUR_COLLECTION_ID_", // Crossmint managed collection
        // "collectionLocator": "crossmint:_YOUR_COLLECTION_ID_:_TEMPLATE_ID_", // With specific template
        "callData": {
          "totalPrice": "5.00",
          "quantity": 1 // matches your contract's parameter name
        }
      }
    ]
  }
  // To use exact-in mode, add executionParameters: { maxSlippageBps: "500" } to the lineItem object. For custom contract params, add executionParameters: { customParam: "value" }.
  ```

  ```json collectionLocator - imported contract theme={null}
  {
    "lineItems": [
      {
        "collectionLocator": "ethereum:0x71c7656ec7ab88b098defb751b7401b5f6d897", // External collection registered in Crossmint Console
        "callData": {
          "totalPrice": "5.00",
          "quantity": 1 // matches your contract's parameter name
          // For external contracts, you might need additional parameters such as:
          // "_amount": 1, // if your mint function uses _amount instead of quantity
          // "tokenId": "123", // if your contract requires a specific tokenId
          // "metadata": "ipfs://...", // if your contract accepts metadata
        }
      }
    ]
  }
  ```

  ```json tokenLocator - EVM theme={null}
  {
    "lineItems": [
      {
        "tokenLocator": "ethereum:0x71c7656ec7ab88b098defb751b7401b5f6d897:1234", // <blockchain>:<contractAddress>:<tokenId>
        "callData": {
          "totalPrice": "25.00" // Only totalPrice is required for token purchases
          // For external EVM contracts, you might need additional parameters:
          // "_amount": 1, // if your contract uses _amount instead of quantity
          // "tokenId": "1234", // if your contract requires explicit tokenId
          // "metadata": "ipfs://...", // if your contract accepts metadata
        }
      }
    ]
  }
  // To use exact-in mode, add executionParameters: { maxSlippageBps: "500" } to the lineItem object. For custom contract params, add executionParameters: { customParam: "value" }.
  ```

  ```json tokenLocator - Solana theme={null}
  {
    "lineItems": [
      {
        "tokenLocator": "solana:7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU", // <blockchain>:<tokenAddress>
        "callData": {
          "totalPrice": "25.00",
          "buyerCreatorRoyaltyPercent": 100 // Required for Solana
        }
      }
    ]
  }
  // To use exact-in mode, add executionParameters: { maxSlippageBps: "500" } to the lineItem object. For custom contract params, add executionParameters: { customParam: "value" }.
  ```

  ```json productLocator theme={null}
  {
    "lineItems": [
      {
        "productLocator": "amazon:B01DFKC2SO", // Amazon ASIN
        // "productLocator": "amazon:https://www.amazon.com/dp/B01DFKC2SO", // Amazon URL
        // "productLocator": "shopify:https://your-store.myshopify.com/products/product-name:123456789", // Shopify
      }
    ]
  }
  ```
</CodeGroup>

<Snippet file="external-evm-contract-parameter-note.mdx" />

<Snippet file="solana-buyer-creator-royalty-snippet.mdx" />

## Complete API Request Examples

For those who want a full copy/pastable code example, extended versions of the JSON guides are provided below.

<CodeGroup>
  ```javascript collectionLocator theme={null}
  const options = {
      method: "POST",
      headers: { "x-api-key": "_YOUR_API_KEY_", "Content-Type": "application/json" },
      body: JSON.stringify({
          recipient: {
              email: "buyer@example.com",
          },
          payment: {
              method: "ethereum-sepolia",
              currency: "eth",
          },
          lineItems: [
              {
                  collectionLocator: "crossmint:_YOUR_COLLECTION_ID_", // Crossmint managed collection
                  // collectionLocator: "crossmint:_YOUR_COLLECTION_ID_:_TEMPLATE_ID_", // With specific template
                  callData: {
                      totalPrice: "5.00",
                      quantity: 1, // matches your contract's parameter name
                  },
              }
          ],
      }),
  };

  fetch("https://staging.crossmint.com/api/2022-06-09/orders", options)
      .then((response) => response.json())
      .then((response) => console.log(response))
      .catch((err) => console.error(err));
  ```

  ```javascript tokenLocator - EVM theme={null}
  const options = {
      method: "POST",
      headers: { "x-api-key": "_YOUR_API_KEY_", "Content-Type": "application/json" },
      body: JSON.stringify({
          recipient: {
              email: "buyer@example.com",
          },
          payment: {
              method: "ethereum-sepolia",
              currency: "eth",
          },
          lineItems: [
              {
                  tokenLocator: "ethereum:0x71c7656ec7ab88b098defb751b7401b5f6d897:1234", // <blockchain>:<contractAddress>:<tokenId>
                  callData: {
                      totalPrice: "25.00", // Only totalPrice is required for token purchases
                      // For external EVM contracts, you might need additional parameters:
                      // _amount: 1, // if your contract uses _amount instead of quantity
                      // tokenId: "1234", // if your contract requires explicit tokenId
                      // metadata: "ipfs://...", // if your contract accepts metadata
                  },
              }
          ],
      }),
  };

  fetch("https://staging.crossmint.com/api/2022-06-09/orders", options)
      .then((response) => response.json())
      .then((response) => console.log(response))
      .catch((err) => console.error(err));
  ```

  ```javascript tokenLocator - Solana theme={null}
  const options = {
      method: "POST",
      headers: { "x-api-key": "_YOUR_API_KEY_", "Content-Type": "application/json" },
      body: JSON.stringify({
          recipient: {
              email: "buyer@example.com",
          },
          payment: {
              method: "solana",
              currency: "sol",
          },
          lineItems: [
              {
                  tokenLocator: "solana:7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU", // <blockchain>:<tokenAddress>
                  callData: {
                      totalPrice: "25.00",
                      buyerCreatorRoyaltyPercent: 100, // Required for Solana
                  },
              }
          ],
      }),
  };

  fetch("https://staging.crossmint.com/api/2022-06-09/orders", options)
      .then((response) => response.json())
      .then((response) => console.log(response))
      .catch((err) => console.error(err));
  ```

  ```javascript productLocator theme={null}
  const options = {
      method: "POST",
      headers: { "x-api-key": "_YOUR_API_KEY_", "Content-Type": "application/json" },
      body: JSON.stringify({
          recipient: {
              email: "buyer@example.com",
              physicalAddress: {
                  name: "John Doe",
                  line1: "123 Main St",
                  city: "San Francisco",
                  state: "CA",
                  postalCode: "94105",
                  country: "US",
              },
          },
          payment: {
              method: "ethereum-sepolia",
              currency: "eth",
          },
          lineItems: [
              {
                  productLocator: "amazon:B01DFKC2SO", // Amazon ASIN
                  // productLocator: "amazon:https://www.amazon.com/dp/B01DFKC2SO", // Amazon URL
                  // productLocator: "shopify:https://your-store.myshopify.com/products/product-name:123456789", // Shopify
              }
          ],
      }),
  };

  fetch("https://staging.crossmint.com/api/2022-06-09/orders", options)
      .then((response) => response.json())
      .then((response) => console.log(response))
      .catch((err) => console.error(err));
  ```

  ```javascript collectionLocator - imported contract theme={null}
  const options = {
      method: "POST",
      headers: { "x-api-key": "_YOUR_API_KEY_", "Content-Type": "application/json" },
      body: JSON.stringify({
          recipient: {
              email: "buyer@example.com",
          },
          payment: {
              method: "ethereum-sepolia",
              currency: "eth",
          },
          lineItems: [
              {
                  collectionLocator: "ethereum:0x71c7656ec7ab88b098defb751b7401b5f6d897", // External collection registered in Crossmint Console
                  callData: {
                      totalPrice: "5.00",
                      quantity: 1, // matches your contract's parameter name
                      // For external contracts, you might need additional parameters such as:
                      // _amount: 1, // if your mint function uses _amount instead of quantity
                      // tokenId: "123", // if your contract requires a specific tokenId
                      // metadata: "ipfs://...", // if your contract accepts metadata
                  },
              }
          ],
      }),
  };

  fetch("https://staging.crossmint.com/api/2022-06-09/orders", options)
      .then((response) => response.json())
      .then((response) => console.log(response))
      .catch((err) => console.error(err));
  ```
</CodeGroup>

<Note>
  For more details on physical product purchases, see our guides for [Amazon
  Integration](/payments/headless/guides/providers/amazon) and [Shopify
  Integration](/payments/headless/guides/providers/shopify).
</Note>

<Snippet file="multiple-line-items-snippet.mdx" />
