How to relate Products to Deals with List Item API via CRM Properties API


#1

Hello all,

I am trying to sync external accounting purchases to create deals in Hubspot. I wish to have line items of products related to the deal in typical Hubspot fashion as if you used the Products functionality inside of a deal to associate line item product name, line item product quantities and line items product pricing which all totals a deal amount. I wish to have some custom line item properties as well that I will add. I can see in the system that Shopify is synced and doing something similar.

Line Items Overview

CRM Properties API

My question: How do I relate the Product Line Items to the Deal as well as create custom properties in Product Line items? Do I need to add custom fields to the Products JSON properties structure? Or are these added at the Line Item level where I combine Deal ID, Products, unit price, tax, etc?? This is a pressing matter and I just need a little understanding as to how this all relates and is customized.

Help is greatly appreciated! Examples of json screenshots with notes is always helpful. Any help is good help!


How to access the Products API to create products
#5

Hi @thecoolcoder,

Happy to help.

You can associate line items with deals using the CRM Associations API. Specifically, you could use this endpoint and the definitionId 19 or 20, depending on the order of objects in your request. See this reference to definitionId values.

To create custom properties for line items, you would call this endpoint of the CRM Object Properties API, specifying line_items as the object_type in the request URL.

For example:

POST https://api.hubapi.com/properties/v2/line_items/properties

{
  "name": "custom_line_item_property",
  "label": "Custom line item property",
  "description": "This is a custom line item property",
  "type": "string",
  "fieldType": "text"
}