What is the Best Way to Record Product Purchases?


I am a long time web developer, but new to the HubSpot API, so forgive me if I sound a bit clueless.

Our organization sells thousands of products, training courses, event registrations, webinars and other things. We would like to send purchases of these things to HubSpot so we can create lists on the fly for our users who have purchased one of these things or a combination of these things, but I am unsure of the best way to do this in HubSpot.

My guess is that the best way to do this is to use the API to send the purchase information, including the product type, product ID and product name to HubSpot once the purchase is confirmed, but I am unsure what elements of the API should be used to best accomplish our goals.

Obviously we want to avoid anything that requires us to manually enter products into HubSpot, since we have so many products and the product list is constantly changing.

Any help is greatly appreciated.


Hi @carltonsmith,

It sounds like you could find the Timeline API helpful. You might consider creating a ‘Purchased product’ event type that you could populate with information about the products purchased by your customers. Events can then be created based on the event type template; these events appear on the contact timeline and can be used in list segmentation. The following documentation covers usage of the Timeline API in detail:


Thank you. I will look at this. I was looking at events before, but it looked like I would need to authenticate my users using OAuth in order to add an event to their timeline - is that not true? I really don’t think it’s reasonable to ask them to go log in to another site so I can add some data to HubSpot for them.


This is from item #4 on the page you linked, which seems to support what I said above:

“Note that you can’t use the developer hapikey to create events. This is because the developer hapikey is only for setting up event-types from your development portal. To create an event for a HubSpot portal, that portal will need to grant access to your application via OAuth. Using our OAuth flow you’ll need to obtain an access token for a portal and use that to add events to that portal’s contacts.”

Is there a way for me to obtain an OAuth token without asking my user to sign in to HubSpot?


Hey @carltonsmith it looks like a good use case for a product I am workin on (depositfix.com). It updates the contact info, creates timeline event and triggers a workflow after the purchase. Please let me know if you’d like a personal demo of it.


Hi @carltonsmith,

When installing your app, you’ll need a user from the portal in question to authenticate the app using OAuth (see below). This only needs to happen when the app is initially installed; after that, you’ll be able to use the access and refresh tokens to authenticate your requests (i.e. adding events).


Thanks, Derek. I will take a closer look at this, as this was not clear to me when I first looked at this.



I was able to get the token, following those instructions, so that’s the good news. However, I note that in my developer application I have a place where I can go to the Timeline API and create new Event Types. For some reason in my main application there doesn’t seem to be a way to do that. Is there a way to create these in the main application using the web interface?



HI @carltonsmith,

You should be able to create event types from your app settings. Click into your app, select Timeline API events, and then click the ‘Create event type’ button.


This selection exists in my developer app, but not in our main app. I need to know how to make it in the main app.