APIs & Integrations

altjx
Contributeur

How to create, update, or read the "Start Date" for a Line Item object?

Résolue

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":

 

Screen Shot 2021-05-20 at 6.27.31 PM.png

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.

1 Solution acceptée
MichaelC
Solution
Guide | Partenaire solutions
Guide | Partenaire solutions

How to create, update, or read the "Start Date" for a Line Item object?

Résolue

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:

MichaelC_0-1621625001527.png

 

Calling the line-item with API gives:

MichaelC_1-1621625034488.png

 

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=

 

 



Need further help with integrations or business development?



Want to help me?

Go to the following links and read through the ideas. If you like them - give the idea an upvote

Upvote the following ideas:

Voir la solution dans l'envoi d'origine

19 Réponses
matthewelliott
Participant

How to create, update, or read the "Start Date" for a Line Item object?

Résolue

Any idea why the start date isn't visible on the quote?

0 Votes
MichaelC
Guide | Partenaire solutions
Guide | Partenaire solutions

How to create, update, or read the "Start Date" for a Line Item object?

Résolue

@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



Need further help with integrations or business development?



Want to help me?

Go to the following links and read through the ideas. If you like them - give the idea an upvote

Upvote the following ideas:

0 Votes
dennisedson
Équipe de développement de HubSpot
Équipe de développement de HubSpot

How to create, update, or read the "Start Date" for a Line Item object?

Résolue

Unsure how @MichaelC had access to my unreleased business plans 👀

0 Votes
altjx
Contributeur

How to create, update, or read the "Start Date" for a Line Item object?

Résolue

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)
altjx
Contributeur

How to create, update, or read the "Start Date" for a Line Item object?

Résolue

Dang. That just created a huge problem in the workflow for me. Thanks though! going to look further into some options.

0 Votes
MichaelC
Guide | Partenaire solutions
Guide | Partenaire solutions

How to create, update, or read the "Start Date" for a Line Item object?

Résolue
Well its not done with automation if you do it with the api. You would need to make your own script do the math and from that update the deal using objects deals patch api.

Alternative is to create a workflow to do the work (not really sure how though)


Need further help with integrations or business development?



Want to help me?

Go to the following links and read through the ideas. If you like them - give the idea an upvote

Upvote the following ideas:

0 Votes
altjx
Contributeur

How to create, update, or read the "Start Date" for a Line Item object?

Résolue

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.

altjx
Contributeur

How to create, update, or read the "Start Date" for a Line Item object?

Résolue

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.

MichaelC
Guide | Partenaire solutions
Guide | Partenaire solutions

How to create, update, or read the "Start Date" for a Line Item object?

Résolue

You are in the right place

 

https://developers.hubspot.com/docs/api/crm/properties

 

MichaelC_0-1621633675406.png

 

And a bit of basic understanding in how line-items work. All line items are copys of the products that act as templates. 

 



Need further help with integrations or business development?



Want to help me?

Go to the following links and read through the ideas. If you like them - give the idea an upvote

Upvote the following ideas:

altjx
Contributeur

How to create, update, or read the "Start Date" for a Line Item object?

Résolue

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.

 

MichaelC
Guide | Partenaire solutions
Guide | Partenaire solutions

How to create, update, or read the "Start Date" for a Line Item object?

Résolue

@altjx Im just happy to help (and escape) - full documentation can always be found in the properties API section. 🙂 



Need further help with integrations or business development?



Want to help me?

Go to the following links and read through the ideas. If you like them - give the idea an upvote

Upvote the following ideas:

altjx
Contributeur

How to create, update, or read the "Start Date" for a Line Item object?

Résolue

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!!

MichaelC
Solution
Guide | Partenaire solutions
Guide | Partenaire solutions

How to create, update, or read the "Start Date" for a Line Item object?

Résolue

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:

MichaelC_0-1621625001527.png

 

Calling the line-item with API gives:

MichaelC_1-1621625034488.png

 

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=

 

 



Need further help with integrations or business development?



Want to help me?

Go to the following links and read through the ideas. If you like them - give the idea an upvote

Upvote the following ideas:

dennisedson
Équipe de développement de HubSpot
Équipe de développement de HubSpot

How to create, update, or read the "Start Date" for a Line Item object?

Résolue
love it!
MichaelC
Guide | Partenaire solutions
Guide | Partenaire solutions

How to create, update, or read the "Start Date" for a Line Item object?

Résolue
Ill look into it after the weekend (or during if im allowed by my at home manager 🤣).

Will you generate the connection with stripe and pdf reports through your own system or will you use hubspots own quotes system?


Need further help with integrations or business development?



Want to help me?

Go to the following links and read through the ideas. If you like them - give the idea an upvote

Upvote the following ideas:

altjx
Contributeur

How to create, update, or read the "Start Date" for a Line Item object?

Résolue

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.

dennisedson
Équipe de développement de HubSpot
Équipe de développement de HubSpot

How to create, update, or read the "Start Date" for a Line Item object?

Résolue

@altjx , long time no see 👋

@MichaelC , any chance you can help here 😀

altjx
Contributeur

How to create, update, or read the "Start Date" for a Line Item object?

Résolue

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.

dennisedson
Équipe de développement de HubSpot
Équipe de développement de HubSpot

How to create, update, or read the "Start Date" for a Line Item object?

Résolue
no worries!