Create and manage ecommerce cart data.
POST
request to crm/v3/objects/cart
.
In the request body, you can include the properties
and associations
objects to set property values and associate the cart with other CRM objects (e.g., contacts and line items). Learn more about order properties and associations below.
properties
object in the request body.For example, the request body below would create a cart with some basic product details based on the information provided by the buyer at checkout.
associations
object. You can also use the associations API to update existing carts after creation.
In the associations
array, include the following fields:
Fields | Type | Description |
---|---|---|
toObjectId | String | The ID of the record that you want to associate the cart with. |
associationTypeId | String | A unique identifier to indicate the association type between the cart and the other object. Below are the CRM objects that you can associate orders with, along with their associationTypeId :To see a list of all association types, check out the associations API documentation. Or, you can retrieve each value by making a GET request to /crm/v4/associations/{fromObjectType}/{toObjectType}/labels . |
POST
request body below would create a cart that’s associated with a specific contact and two line items.
GET
request to /crm/v3/objects/cart
.GET
request to the above URL and specify a cart ID. For example: /crm/v3/objects/cart/44446244097
.POST
request to the search endpoint and include filters in the request body. Learn more about searching the CRM.properties
query parameter in the request URL along with comma-separated property names. For example, making a GET
request to the following URL would result in the response below:
/crm/v3/objects/cart?properties=hs_external_cart_id&hs_external_status
GET
request to crm/v3/properties/cart
.
Learn more about cart properties.
POST
request that includes your filter criteria in the request body.
For example, to search for all carts placed at a specific store, you would make a POST
request to crm/v3/objects/cart/search
with the following request body:
GET
request to:
crm/v3/objects/cart/{cartId}/associations/contact
This will return the IDs of the currently associated contact, along with meta information about the association type.
GET
request to crm/v3/objects/contacts/301
.
filters
array specifies the search criteria, while the properties
array specifies which properties to return.
PATCH
request to /crm/v3/objects/cart/{cartId}
. In the request body, include a properties
object containing the properties that you want to update.
For example, if you wanted to update a cart after it’s been fulfilled, you could send the following request body:
PUT
request to /crm/v3/objects/cart/{cartId}/associations/{toObjectType}/{toObjectId}/{associationTypeId}
. You can also use the associations API.
associationTypeId
values for cart-to-object associations. You can also make a GET
request to /crm/v4/associations/{fromObjectType}/{toObjectType}/labels
.To see all a list of all values, check out the associations API documentation.PUT
request to the following URL:
/crm/v3/objects/cart/{cartId}/associations/order/{orderId}/592
The response will return a set of default properties along with an associations
object containing information about the association that you set.
DELETE
request to the following URL:
/crm/v3/objects/cart/{cartId}/associations/{toObjectType}/{toObjectId}/{associationTypeId}
For example, if you wanted to remove an associated line item from a cart, your request URL would be the following:
/crm/v3/objects/cart/{cartId}/associations/line_items/{lineItemId}/590
GET
request to /crm/v3/properties/cart
. Learn more about using the properties API.
Property name | Label in UI | Description |
---|---|---|
hs_cart_name | Name | The name in an external system. |
hs_external_cart_id | Cart ID | Unique identifier from an external system. |
hs_source_store | Source Store | Data used to identify which store the cart came from. |
hs_external_status | Status | The current status of the cart. |
hs_cart_url | Cart Url | The recovery URL that’s sent to a customer so they can revive an abandoned cart. |
hs_total_price | Total Price | The sum total amount associated with the cart. |
hs_currency_code | Currency Code | The currency code used in the cart. |
hs_cart_discount | Cart Discount | Amount of discount in the cart. |
hs_tags | Tags | A collection of tag strings for the cart. |