We use cookies to make HubSpot's community a better place. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. To learn more, and to see a full list of cookies we use, check out our Cookie Policy (baked goods not included).
May 20, 2021 6:32 PM - edited May 21, 2021 9:53 AM
I have managed to whip up a really nice system with my product and HubSpot's API pretty quickly; however, I found myself pretty stumped at the part where I need to manage the start date for a line item. For example, the second column in this screenshot mentions "Start Date":
When looking at the documentation for this object (https://developers.hubspot.com/docs/api/crm/line-items), I don't see anything here regarding the "Start Date". In our particular case, we're automating all of our payments via Stripe from the SaaS platform, so the user never interacts with HubSpot, any PDF documents, etc.
So basically, when the user submits payment from Stripe, Stripe informs us and we update the deal to include additional line items in Hubspot CRM.
Is there a better way for me to do this or are there any suggestions on how to create this line item to include the start date of the current date? I've tried adding the "start_date", "startdate" to the properties json keys, but doesn't seem like any of them work.
Solved! Go to Solution.
May 21, 2021 3:25 PM - edited May 21, 2021 3:29 PM
Happy news - I managed to escape my wife and found the solution! (I just want this sentence to be a part of the official solution so dont you dare edit this Dennis!)
Answer: Property name is "hs_recurring_billing_start_date".
It returns null if its "at payment" and date if the date is specified.
Example:
Calling the line-item with API gives:
Using the call:
GET https://api.hubapi.com/crm/v3/objects/line_items?limit=10&properties=hs_recurring_billing_start_date&archived=false&hapikey=my-super-duper-secret-api-key
Have a great weekend guys! 🙂
Edit:
Finally let me know how I found out:
Calling the properties API -- it was not listed anywhere in the official documentation - or even visible in the settings of the portal properties.
GET https://api.hubapi.com/crm/v3/properties/products?archived=false&hapikey=
Feb 22, 2022 12:35 AM
Any idea why the start date isn't visible on the quote?
May 24, 2021 1:03 PM
@altjx
If you are selling subscriptions, services or things on a monthly/ quarterly/ yearly payment plan you need to take terms of contract into consideration as well.
Lets say its a contract for 2 years - you need to take the value per month times x 24 months.
Equation is:
Amount of items x price per item x amount of times per year the line-item will be invoiced (monthly = 12, quarterly = 4 and so on) x terms of contract in years
Lets say im selling a subscription:
Terms of contract is 3 years (you have to subscribe for 3 years)
Renting Dennis shoes (2 pair x 50 USD per month x 12 x 3)
Renting Dennis hat (1 hat x 25 USD per quarter x 4 x 3)
Renting Dennis t-shirt (1 t-shirt x 10 USD per year x 1 x 3)
Consulting fee (one time) (100 USD)
Deal total value
3600 USD +
300 USD +
30 USD +
100 USD
Total value: 4030 USD
May 24, 2021 1:06 PM
Unsure how @MichaelC had access to my unreleased business plans 👀
May 24, 2021 12:46 PM
Thanks again for your help, Michael! I took a little bit of time to understand how the Properties work, which was super helpful in figuring out which values were available and which ones could be updated.
I also updated the code to automatically update the total cost of the deal amount upon completion of adding/removing/updating line items. FWIW if anyone else needs guidance:
total_value = []
line_items = find_line_items_associated_to_deal(deal_id)
line_item_ids = line_items['results'].map { |i| i['id'] }
line_item_ids.each do |line_item_id|
total_value << get_request("objects/line_items/#{line_item_id}?properties=hs_tcv")['properties']['hs_tcv'].to_f
end
deal_data = { properties: { amount: total_value.sum } }
patch_request("objects/deal/#{deal_id}?", deal_data)
May 22, 2021 5:41 PM
Dang. That just created a huge problem in the workflow for me. Thanks though! going to look further into some options.
May 22, 2021 3:36 PM
May 22, 2021 2:44 PM - edited May 22, 2021 2:44 PM
One more question if you're still around @MichaelC . After associating a line item to a deal, do you know how to have the deal's amount automatically updated? I see this is possible in the UI. So if I have a deal that has an amount of $0, and I associate a line item that contains a price, the UI gives me the ability to "Update the deal amount" or "Save without updating the deal amount". I wonder how this can be accomplished via the API?
I think alternatively, I'd have to automatically update and keep track of these.
May 22, 2021 1:35 PM - edited May 22, 2021 1:36 PM
Gotcha. Thanks Michael. I've implemented a good portion of the HubSpot API through the SaaS platform, but I think this is just the first time I've run across something that I had to guess/assume and not see specifically documented/mentioned, so it threw me off a bit.
May 21, 2021 5:48 PM
You are in the right place
https://developers.hubspot.com/docs/api/crm/properties
And a bit of basic understanding in how line-items work. All line items are copys of the products that act as templates.
May 21, 2021 4:52 PM
Thanks Michael. One more thing -- where exactly is the properties API section? I see https://developers.hubspot.com/docs/api/crm/properties, but I still don't see anything related to what you just pointed out sadly.
May 21, 2021 4:47 PM
@altjx Im just happy to help (and escape) - full documentation can always be found in the properties API section. 🙂
May 21, 2021 4:04 PM
Nice!!! Thanks a lot !!! Hahaha. Yeah that's really weird that it doesn't exist in the documentation, but really happy you found it!! Much appreciated!!
May 21, 2021 3:25 PM - edited May 21, 2021 3:29 PM
Happy news - I managed to escape my wife and found the solution! (I just want this sentence to be a part of the official solution so dont you dare edit this Dennis!)
Answer: Property name is "hs_recurring_billing_start_date".
It returns null if its "at payment" and date if the date is specified.
Example:
Calling the line-item with API gives:
Using the call:
GET https://api.hubapi.com/crm/v3/objects/line_items?limit=10&properties=hs_recurring_billing_start_date&archived=false&hapikey=my-super-duper-secret-api-key
Have a great weekend guys! 🙂
Edit:
Finally let me know how I found out:
Calling the properties API -- it was not listed anywhere in the official documentation - or even visible in the settings of the portal properties.
GET https://api.hubapi.com/crm/v3/properties/products?archived=false&hapikey=
May 21, 2021 3:30 PM
May 21, 2021 2:24 PM
May 21, 2021 2:26 PM
Thanks Michael! I'll be generating the connection with Stripe and PDF reports through my own system as we'll be leveraging the API to communicate back to Hubspot to update the deal.
May 21, 2021 1:37 PM
May 21, 2021 1:43 PM
Thanks @dennisedson . Sorry I haven't been much help in the other threads you've tagged me in. Going through the growing pains so I've been knee deep in code with the platform lol.
May 21, 2021 1:47 PM