APIs & Integrations

Mahesh1250
Contributor

Can't able to see Line_items created for Deal using Ecommerce Bridge API

SOLVE

Hi Experts,

 

Our requirement is to create a deal with a list of items. i.e. a Deal is nothing but an Order & line_items are nothing but an order Items.

 

Here we're not creating products as per now - we're just storing the product name in a list_item attribute.

 

{
  "storeId": "ecommercebridge-deviceb2b-store",
  "objectType": "DEAL",
  "messages": [
    {
      "action": "UPSERT",
      "changedAt": "1574786280000",
      "externalObjectId": "deal_1234567",
      "properties": {
        "name": "ecomm Deal3",
        "stage": "checkout_completed",
        "purchase_date": "1574786280000"
      },
      "associations": {
        "CONTACT": [
          "ecomm@test.com"
        ]
      }
    }
  ]
}
{
    "storeId": "ecommercebridge-deviceb2b-store",
    "objectType": "LINE_ITEM",
    "messages": [
        {
            "action": "UPSERT",
            "changedAt": "1574786280000",
            "externalObjectId": "lineitem_1234567",
            "properties": {
                "name": "lineItem1_withProduct"
            },
            "associations": {
                "DEAL": [
                    "deal_1234567"
                ]
            }
        }
    ]
}

no errors. but can't able to see this line_item in the deal.

 

As per documentation, created a dummy product and assigned line_item to that product - but still can't able to see the line_items. 

 

dummy product like 

{
    "storeId": "ecommercebridge-deviceb2b-store",
    "objectType": "LINE_ITEM",
    "messages": [
        {
            "action": "UPSERT",
            "changedAt": "1574786280000",
            "externalObjectId": "lineitem_1234567",
            "properties": {
                "name": "lineItem1_withProduct"
            },
            "associations": {
                "DEAL": [
                    "deal_1234567"
                ],
                "PRODUCT": [
                    "testProduct"
                ]
            }
        }
    ]
}

Please let me know where I can see the line_items related to a Deal in HS Dashboard.

 

Screen Shot 2019-11-29 at 6.32.12 pm.png

 

cc : @IsaacTakushi 

0 Upvotes
2 Accepted solutions
himanshurauthan
Solution
Thought Leader | Elite Partner
Thought Leader | Elite Partner

Can't able to see Line_items created for Deal using Ecommerce Bridge API

SOLVE
Hello @Mahesh1250

The basic process of running a ecomm bridge V2 is:

1. Create a store
2. Syncing product objects with system object id.
3. Creating contacts and deals and kine items

For deals, we send the property values and the object id as per our system ID. For line items, we need a product to be created on HubSpot with product type as PRODUCT.

In your code for dummy product, I can see that you have used line item as object type. It should be PRODUCT.

Next for line items in deals, we need to create those via API with object type LINE ITEM and in this we need to associate a product and a deal. For association we have to pass the value which have been passed as external object id while creating product and deal. This will bind the product as line item to deal.

Thanks
Digital Marketing & Inbound Expert In Growth Hacking Technology

View solution in original post

himanshurauthan
Solution
Thought Leader | Elite Partner
Thought Leader | Elite Partner

Can't able to see Line_items created for Deal using Ecommerce Bridge API

SOLVE

Hii @Mahesh1250 

 

Q#1: Without Product creation, we won't able to see/create line_items?
Ans#1: Yes, a product should exist on HubSpot before creation of a line item.

 

Q#2: If we started creating Products like the above process, every time it'll create new products to each deal which leads to a duplication of products or do we need to fetch the already created product with externalObjectId?
Ans#2: In this case, I will suggest you to please complete the sync of all products to HubSpot and then start creating the line items. Also as if you have noticed then in the sync API we use to send a Parameter called externalObjectId and its the ID of the object at our end which will not be changed anyhow. So even if a sync API is executed for a PRODUCT for multiple times then NO ISSUE. It will be mapped with externalObjectId and no duplicate records will be formed.

Thanks.

Digital Marketing & Inbound Expert In Growth Hacking Technology

View solution in original post

4 Replies 4
himanshurauthan
Solution
Thought Leader | Elite Partner
Thought Leader | Elite Partner

Can't able to see Line_items created for Deal using Ecommerce Bridge API

SOLVE
Hello @Mahesh1250

The basic process of running a ecomm bridge V2 is:

1. Create a store
2. Syncing product objects with system object id.
3. Creating contacts and deals and kine items

For deals, we send the property values and the object id as per our system ID. For line items, we need a product to be created on HubSpot with product type as PRODUCT.

In your code for dummy product, I can see that you have used line item as object type. It should be PRODUCT.

Next for line items in deals, we need to create those via API with object type LINE ITEM and in this we need to associate a product and a deal. For association we have to pass the value which have been passed as external object id while creating product and deal. This will bind the product as line item to deal.

Thanks
Digital Marketing & Inbound Expert In Growth Hacking Technology
Mahesh1250
Contributor

Can't able to see Line_items created for Deal using Ecommerce Bridge API

SOLVE

Hi @himanshurauthan,

 

Thanks for the response and detail explanation. 

 

As per the steps suggested, I tried & it works as below

 

Step # 1: Creating Deal & assigning to an existing contact

{
  "storeId": "ecommercebridge-deviceb2b-store",
  "objectType": "DEAL",
  "messages": [
    {
      "action": "UPSERT",
      "changedAt": "1574786280000",
      "externalObjectId": "deal_1234567",
      "properties": {
        "name": "ecomm Deal3",
        "stage": "checkout_completed",
        "purchase_date": "1574786280000"
      },
      "associations": {
        "CONTACT": [
          "ecomm@test.com"
        ]
      }
    }
  ]
}

Step # 2: Creating Product with externalObjectId

{
    "storeId": "ecommercebridge-deviceb2b-store",
    "objectType": "PRODUCT",
    "messages": [
        {
            "action": "UPSERT",
            "changedAt": "1574786280000",
            "externalObjectId": "product2_1234567",
            "properties": {
                "product_name": "Product2 via API",
                "product_description": "Product2 Description",
                "price": "10.00"
            }
        }
    ]
}

Step # 3: Creating Line_item & associating with Product & Deal 

{
    "storeId": "ecommercebridge-deviceb2b-store",
    "objectType": "LINE_ITEM",
    "messages": [
        {
            "action": "UPSERT",
            "changedAt": "1574786280000",
            "externalObjectId": "lineitem2_1234567",
            "properties": {
                "name": "lineItem2_withProduct",
                "tax_amount": "1.00",
                "price":"10.00"
            },
            "associations": {
                "DEAL": [
                    "deal_1234567"
                ],
                "PRODUCT": [
                    "product2_1234567"
                ]
            }
        }
    ]
}

Now, Deal Dashboard looks like this 

Screen Shot 2019-12-01 at 8.30.12 am.png

 

Which is exactly what I want. Thanks for this 🙂

 

Please confirm these queries.

Q#1: Without Product creation, we won't able to see/create line_items?

Q#2: If we started creating Products like the above process, every time it'll create new products to each deal which leads to a duplication of products or do we need to fetch the already created product with externalObjectId? - tried like this but getting below exception.

 

Screen Shot 2019-12-01 at 8.45.54 am.png

 

Tried to fetch all products and below is the result 

Screen Shot 2019-12-01 at 8.55.27 am.png

Please suggest to me by using which field, can we fetch the exact product created via API?

 

Thanks,

Mahesh.S

0 Upvotes
himanshurauthan
Solution
Thought Leader | Elite Partner
Thought Leader | Elite Partner

Can't able to see Line_items created for Deal using Ecommerce Bridge API

SOLVE

Hii @Mahesh1250 

 

Q#1: Without Product creation, we won't able to see/create line_items?
Ans#1: Yes, a product should exist on HubSpot before creation of a line item.

 

Q#2: If we started creating Products like the above process, every time it'll create new products to each deal which leads to a duplication of products or do we need to fetch the already created product with externalObjectId?
Ans#2: In this case, I will suggest you to please complete the sync of all products to HubSpot and then start creating the line items. Also as if you have noticed then in the sync API we use to send a Parameter called externalObjectId and its the ID of the object at our end which will not be changed anyhow. So even if a sync API is executed for a PRODUCT for multiple times then NO ISSUE. It will be mapped with externalObjectId and no duplicate records will be formed.

Thanks.

Digital Marketing & Inbound Expert In Growth Hacking Technology
yer
Member

Can't able to see Line_items created for Deal using Ecommerce Bridge API

SOLVE

I'm able to create the line items and go to the deal and see the products but where can I see the custom properties I created for the line items?

0 Upvotes