

# Object type mapping for the standard order in Amazon Connect Customer Profiles
<a name="object-type-mapping-standard-order"></a>

The topics in this section provide the standard order definition, and the object type mapping from external applications to the standard order.

**Topics**
+ [Amazon AppIntegrations access requirements](standard-order-appintegrations-requirements.md)
+ [Amazon EventBridge access requirements](standard-order-eventbridge-requirements.md)
+ [Standard order definition](standard-order-definition.md)
+ [Mapping Shopify objects](mapping-shopify-objects-standard-order.html.md)

# Amazon AppIntegrations access requirements
<a name="standard-order-appintegrations-requirements"></a>

Use the following Amazon AppIntegrations access requirements to create and delete Shopify integrations with Amazon Connect Customer Profiles:
+ app-integrations:GetEventIntegration
+ app-integrations:ListEventIntegrationAssociations
+ app-integrations:CreateEventIntegrationAssociation
+ app-integrations:DeleteEventIntegrationAssociation

# Amazon EventBridge access requirements
<a name="standard-order-eventbridge-requirements"></a>

Use the following Amazon EventBridge access requirements to create and delete Shopify integrations with Amazon Connect Customer Profiles:
+ `events:ListTargetsByRule`
+ `events:PutRule`
+ `events:PutTargets`
+ `events:DeleteRule`
+ `events:RemoveTargets`

# Customer Profiles standard order object fields
<a name="standard-order-definition"></a>

The following table lists all the fields in the Customer Profiles standard order object.


| Standard order field | Data type | Description | 
| --- | --- | --- | 
| OrderId | String | The unique identifier of a standard order. | 
| CustomerEmail | String | The customer's email address. | 
| CustomerPhone | String | The customer's phone number. | 
| CreatedDate | String | The order's date created. | 
| UpdatedDate | String | The order's date updated. | 
| ProcessedDate | String | The order's date processed. | 
| ClosedDate | String | The order's date closed. | 
| CancelledDate | String | The order's date cancelled. | 
| CancelReason | String | The order's cancel reason. | 
| Name | String | The order's name. | 
| AdditionalInformation | String | Any additional information relevant to the order. | 
| Gateway | String | The order's payment gateway. | 
| Status | String | The order's status. | 
| StatusCode | String | The order's status code. Valid values: DRAFT \$1 ACTIVATED | 
| StatusUrl | String | The order's status URL. | 
| CreditCardNumber | String | The customer's credit card last four digits. | 
| CreditCardCompany | String | The customer's credit card company. | 
| FulfillmentStatus | String | The order's fulfillment status. | 
| TotalPrice | String | The order's total price. | 
| TotalTax | String | The order's total tax. | 
| TotalDiscounts | String | The order's total discounts. | 
| TotalItemsPrice | String | The order's total items price. | 
| TotalShippingPrice | String | The order's total shipping price. | 
| TotalTipReceived | String | The order's total tip received. | 
| Currency | String | The order's currency. | 
| TotalWeight | String | The order's total weight. | 
| BillingAddress | OrderAddress | The customer's billing address. | 
| ShippingAddress | OrderAddress | The customer's shipping address. | 
| OrderItems | OrderItem list | The order's items. | 
| Attributes | String-to-string map | Key-value pair of attributes of a standard order. | 

The standard order objects are indexed by the keys in the following table.


| Standard index name | Standard order field | 
| --- | --- | 
| \$1orderId | OrderId | 

For example, you can use `_orderId` as a key name with the [SearchProfiles API](https://docs.aws.amazon.com/customerprofiles/latest/APIReference/API_SearchProfiles.html) to find a profile that has an order whose OrderId matches with the search value. You can find the standard order objects associated with a specific profile by using the [ListProfileObjects API](https://docs.aws.amazon.com/customerprofiles/latest/APIReference/API_ListProfileObjects.html) with the `ProfileId` and `ObjectTypeName` set to `_order`.

## OrderAddress data type
<a name="orderaddress-data-type"></a>


| Standard order field | Data type | Description | 
| --- | --- | --- | 
| Name | String | The name associated with an order address. | 
| Address1 | String | The first line of an order address. | 
| Address2 | String | The second line of an order address. | 
| Address3 | String | The third line of an order address. | 
| Address4 | String | The fourth line of an order address. | 
| City | String | The city of an order address. | 
| County | String | The county of an order address. | 
| State | String | The state of an order address. | 
| Province | String | The province of an order address. | 
| Country | String | The country of an order address. | 
| PostalCode | String | The postal code of an order address. | 

## OrderItem data type
<a name="orderitem-data-type"></a>


| Standard order field | Data type | Description | 
| --- | --- | --- | 
| Title | String | The title of an order item. | 
| Price | String | The price of an order item. | 
| Quantity | String | The quantity of an order item. | 

# Mapping Shopify objects to the standard order in Amazon Connect Customer Profiles
<a name="mapping-shopify-objects-standard-order.html"></a>

This topic lists which fields in Shopify objects map to fields in the standard order object in Customer Profiles.

## Shopify-DraftOrder object
<a name="shopify-draftorder-object.html"></a>

For a list of all the fields in a Shopify-DraftOrder object see [The DraftOrder object](https://shopify.dev/api/admin-rest/2021-10/resources/draftorder#resource_object) in the Shopify documentation.

## Mapping a Shopify-DraftOrder object to a standard order
<a name="shopify-draftorder-object-standardorder.html"></a>

A subset of the fields in the Shopify-DraftOrder object map to the standard order object in Customer Profiles.

The following table lists which fields can be mapped from the Shopify-DraftOrder object to the standard order.

 The `StatusCode` is `ACTIVATED` if `order_status_url` exists in the source. Otherwise, the `StatusCode` is `DRAFT`.


|  Shopify-DraftOrder source field  |  Standard order target field  | 
| --- | --- | 
| id | Attributes.ShopifyOrderId | 
| customer.id | Attributes.ShopifyCustomerId | 
| note | AdditionalInformation | 
| email | CustomerEmail | 
| currency | Currency | 
| created\$1at | CreatedDate | 
| updated\$1at | UpdatedDate | 
| name | Name | 
| status | Status | 
| order\$1status\$1url | StatusCode | 
| billing\$1address.address1 | BillingAddress.Address1 | 
| billing\$1address.address2 | BillingAddress.Address2 | 
| billing\$1address.city | BillingAddress.City | 
| billing\$1address.zip | BillingAddress.PostalCode | 
| billing\$1address.province | BillingAddress.Province | 
| billing\$1address.country | BillingAddress.Country | 
| billing\$1address.name | BillingAddress.Name | 
| shipping\$1address.address1 | ShippingAddress.Address1 | 
| shipping\$1address.address2 | ShippingAddress.Address2 | 
| shipping\$1address.city | ShippingAddress.City | 
| shipping\$1address.zip | ShippingAddress.PostalCode | 
| shipping\$1address.province | ShippingAddress.Province | 
| shipping\$1address.country | ShippingAddress.Country | 
| shipping\$1address.name | ShippingAddress.Name | 
| invoice\$1url | StatusUrl | 
| total\$1price | TotalPrice | 
| total\$1tax | TotalTax | 
| line\$1items[].title | OrderItems[].Title | 
| line\$1items[].price | OrderItems[].Price | 
| line\$1items[].quantity | OrderItems[].Quantity | 

### Example
<a name="example-shopify-draftorder-object-standardorder.html"></a>

The following example shows how to map a source field to a target field.

```
"shopifyOrderId": {
    "Source": "_source.detail.event.detail.payload.id",
    "Target": "_order.Attributes.ShopifyOrderId"
}
```

The Shopify-DraftOrder customer data from the Shopify object is associated with an Amazon Connect standard order using the following index.


| Standard Index Name  | Shopify-DraftOrder source field  | 
| --- | --- | 
| \$1shopifyOrderId | id | 

For example, you can use `_shopifyOrderId` as an `ObjectFilter.KeyName` with the the [ListProfileObjects](https://docs.aws.amazon.com/customerprofiles/latest/APIReference/API_ListProfileObjects.html) API to find a standard order. You can find the Shopify-DraftOrder objects associated with a specific profile by using the [ListProfileObjects](https://docs.aws.amazon.com/customerprofiles/latest/APIReference/API_ListProfileObjects.html) API with the `ProfileId` and `ObjectTypeName` set to `Shopify-DraftOrder`.

## Shopify-Order object
<a name="shopify-order-object.html"></a>

For a list of all the fields in a Shopify-Order object see [The Order object](https://shopify.dev/api/admin-rest/2021-10/resources/order#resource_object) in the Shopify documentation.

## Mapping a Shopify-Order object to a standard order
<a name="mapping-shopify-order-object-standarorder.html"></a>

A subset of the fields in the Shopify-Order object map to the standard order object in Customer Profiles.

The following table lists which fields can be mapped from the Shopify-Order object to the standard order.

The `StatusCode` is `ACTIVATED` if `order_status_url` exists in the source. Otherwise, the `StatusCode` is `DRAFT`.


| Shopify-Order source field | Standard order target field | 
| --- | --- | 
| id | Attributes.ShopifyOrderId | 
| customer.id | Attributes.ShopifyCustomerId | 
| cancelled\$1at | CancelledDate | 
| cancel\$1reason | CancelReason | 
| closed\$1at | ClosedDate | 
| created\$1at | CreatedDate | 
| currency | Currency | 
| email | CustomerEmail | 
| financial\$1status | Status | 
| order\$1status\$1url | StatusCode | 
| fulfillment\$1status | FulfillmentStatus | 
| gateway | Gateway | 
| name | Name | 
| note | AdditionalInformation | 
| order\$1status\$1url | StatusUrl | 
| phone | CustomerPhone | 
| processed\$1at | ProcessedDate | 
| total\$1discounts | TotalDiscounts | 
| total\$1line\$1items\$1price | TotalItemsPrice | 
| total\$1price | TotalPrice | 
| total\$1shipping\$1price\$1set.shop\$1money.amount | TotalShippingPrice | 
| total\$1tax | TotalTax | 
| total\$1tip\$1received | TotalTipReceived | 
| total\$1weight | TotalWeight | 
| updated\$1at | UpdatedDate | 
| billing\$1address.address1 | BillingAddress.Address1 | 
| billing\$1address.address2 | BillingAddress.Address2 | 
| billing\$1address.city | BillingAddress.City | 
| billing\$1address.zip | BillingAddress.PostalCode | 
| billing\$1address.province | BillingAddress.Province | 
| billing\$1address.country | BillingAddress.Country | 
| billing\$1address.name | BillingAddress.Name | 
| payment\$1details.credit\$1card\$1number | CreditCardNumber | 
| payment\$1details.credit\$1card\$1company | CreditCardCompany | 
| shipping\$1address.address1 | ShippingAddress.Address1 | 
| shipping\$1address.address2 | ShippingAddress.Address2 | 
| shipping\$1address.city | ShippingAddress.City | 
| shipping\$1address.zip | ShippingAddress.PostalCode | 
| shipping\$1address.province | ShippingAddress.Province | 
| shipping\$1address.country | ShippingAddress.Country | 
| shipping\$1address.name | ShippingAddress.Name | 
| line\$1items[].title | OrderItems[].Title | 
| line\$1items[].price | OrderItems[].Price | 
| line\$1items[].quantity | OrderItems[].Quantity | 

### Example
<a name="example-shopify-draftorder-object-standardorder.html"></a>

The following example shows how to map a source field to a target field.

```
"shopifyOrderId": {
    "Source": "_source.detail.event.detail.payload.id",
    "Target": "_order.Attributes.ShopifyOrderId"
}
```

The Shopify-Order customer data from the Shopify object is associated with an Amazon Connect standard order using the following index.


| Standard Index Name | Shopify-Order source field | 
| --- | --- | 
| \$1shopifyOrderId | id | 

For example, you can use `_shopifyOrderId` as an `ObjectFilter.KeyName` with the the [ListProfileObjects](https://docs.aws.amazon.com/customerprofiles/latest/APIReference/API_ListProfileObjects.html) API to find a standard order. You can find the Shopify-Order objects associated with a specific profile by using the [ListProfileObjects](https://docs.aws.amazon.com/customerprofiles/latest/APIReference/API_ListProfileObjects.html) API with the `ProfileId` and `ObjectTypeName` set to `Shopify-Order`.