---
schema_version: "1"
id: 537812e7af3dfb88f7070af81e1743f1d87217354d3537edd67d66c790285c7a
title: Order Interaction
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/data-cloud/interactions-sdk/guides/c360a-api-order-interaction.md
canonical_url: https://developer.salesforce.com/docs/data/salesforce-interactions-sdk/guide/c360a-api-order-interaction.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: c05fcdf79997f08ccc8e842a473a8d3fd12fe2f9e39b31ef42965b49f3dab74b
products:
  - Salesforce Interactions SDK
  - Data 360 Developer Documentation
---
# Order Interaction

An Order interaction is an ecommerce event used to capture actions related to new, in progress, or completed orders. This is the standard interaction data model for reporting purchases, returns, cancellations, and other order lifecycle events.

## Order Interaction Structure

The `order` object defines the details of the transaction, while `interaction.name` defines the action being taken.

| Field Name         | Field Type                                    | Description                                                                                                                                                                            |
| ------------------ | --------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `name`             | string                                        | **Required**. The type of order interaction that occurred. Use the [standard SDK constants](#standard-interaction-names) for this field. For example, `Purchase`, `Return`, and so on. |
| `order.id`         | string                                        | **Required**. A unique identifier representing the order.                                                                                                                              |
| `order.totalValue` | number                                        | **Required**. The total value of the order.                                                                                                                                            |
| `order.lineItems`  | [Line Item Data](https://developer.salesforce.com/docs/data/salesforce-interactions-sdk/guide/c360a-api-line-item-data.md) | An array of Line Item Data values.                                                                                                                                                     |
| `order.currency`   | string                                        | The currency of the order.                                                                                                                                                             |
| `order.attributes` | object                                        | A user-supplied value.                                                                                                                                                                 |

Here's the structure of an `order` interaction with the minimum required fields, `lineItems`, and optional `attributes`.

```json
{
  "interaction": {
    "name": "Purchase",
    "order": {
      "id": "9432", // Required: Unique Order ID
      "totalValue": 9.99, // Required: Final price
      "currency": "USD",
      "lineItems": [
        {
          // Array of purchased items
          "catalogObjectType": "Product",
          "catalogObjectId": "product-xyz",
          "quantity": 1,
          "price": 9.99,
          "attributes": {
            "giftWrapping": 1
          }
        }
      ]
    },
    "attributes": {
      // Attributes for the entire interaction/order
      "promoCode": "SAVE10"
    }
  }
}
```

## Standard Interaction Names

Always use the built-in constants for the `interaction.name` field to ensure consistency across your instrumentation.

| Name                                                   | Value      |
| ------------------------------------------------------ | ---------- |
| `SalesforceInteractions.OrderInteractionName.Purchase` | `Purchase` |
| `SalesforceInteractions.OrderInteractionName.Return`   | `Return`   |
| `SalesforceInteractions.OrderInteractionName.Cancel`   | `Cancel`   |
| `SalesforceInteractions.OrderInteractionName.Preorder` | `Preorder` |
| `SalesforceInteractions.OrderInteractionName.Exchange` | `Exchange` |
| `SalesforceInteractions.OrderInteractionName.Ship`     | `Ship`     |
| `SalesforceInteractions.OrderInteractionName.Deliver`  | `Deliver`  |

## Implementation Examples

### Using the SDK

This example shows how to capture a purchase interaction, typically fired once on the order confirmation page.

```javascript
SalesforceInteractions.sendEvent({
  interaction: {
    name: "Purchase",
    order: {
      id: "9432",
      totalValue: 9.99,
      currency: "USD",
      lineItems: [
        {
          catalogObjectType: "Product",
          catalogObjectId: "product-xyz",
          quantity: 1,
          price: 9.99,
          attributes: {
            giftWrapping: 1,
          },
        },
      ],
    },
    attributes: {
      promoCode: "SAVE10",
    },
  },
});
```

### Using the Sitemap

Here's how to use the sitemap to automatically fire a purchase event.

```javascript
SalesforceInteractions.init().then(() => {
  const sitemapConfig = {
    global: {},
    pageTypes: [
      {
        name: "product_detail",
        isMatch: () => true,
        interaction: {
          name: SalesforceInteractions.OrderInteractionName.Purchase,
          order: {
            id: "9432",
            totalValue: 9.99,
            currency: "USD",
            lineItems: [
              {
                catalogObjectType: "Product",
                catalogObjectId: "product-xyz",
                quantity: 1,
                price: 9.99,
                attributes: {
                  giftWrapping: 1,
                },
              },
            ],
          },
          attributes: {
            promoCode: "SAVE10",
          },
        },
      },
    ],
  };
  SalesforceInteractions.initSitemap(sitemapConfig);
});
```

**See Also**

- [Translation of SDK Events to Web Connector Schemas](https://developer.salesforce.com/docs/data/salesforce-interactions-sdk/guide/c360a-api-translating-sdk-events-to-web-connector-schemas.md)
- [Custom Events](https://developer.salesforce.com/docs/data/salesforce-interactions-sdk/guide/c360a-api-custom-events.md)
