saas•hapily blog

Parsing Stripe Metadata the Easy Way in HubSpot

Written by David Staat | Jun 16, 2023 8:27:28 PM

So you’re using saas•hapily to sync your Stripe account to your HubSpot account. You have chosen wisely! But say you’re using metadata to keep track of some additional information on your subscriptions. How does saas•hapily handle that?

It syncs it over into a subscription property called Subscription Metadata. Typically in the format of {“Key”:”Value”}.

 


Well that’s all fine and good, but how can this metadata be utilized now that it’s in your HubSpot? How do you parse the information from these key value pairs? The same way you get most other things done in HubSpot! That’s right. It’s workflow time!


How do you parse Stripe metedata?


To give you an example, let’s take a hypothetical scenario. On each subscription, you have a metadata key called Subscriptiontier that can be set to Regular or VIP. Useful information right? It lets you know if you need to go the extra mile for your customer. So how can we reflect that in HubSpot?

We can create a workflow that updates a property in that customer’s contact record based on that key value pair. For the purposes of this example, I created a custom contact property called Type to update.

1. Start by creating a contact based workflow.

2. Set the enrollment trigger to saas•hapily Subscription Metadata contains any of {“Subscriptiontier”:”VIP”} OR saas•hapily Subscription Metadata contains any of {“Subscriptiontier”:”Regular”}.

Make sure you include those curly braces and quotation marks. Your workflow will need them. Also make sure to turn re-enrollment on in case any updates are made to the metadata

 


3. Click the “+” button beneath the enrollment trigger and select the If/then branch action.

4. Name the first branch VIP and set the filter to saas•hapily Subscription is equal to any of {“Subscriptiontier”:”VIP”}.





5. Add another branch and name it Regular and set the filter to saas•hapily Subscription is equal to any of {“Subscriptiontier”:”Regular”}.




6. Click the “+” button on the VIP branch and select the Set property value action.

7. Set the Target object to Contact. This will update the property within the contact going through this workflow.

8. Under Property to set, select Type.

9. Under the Type property field, type in VIP and click Save.





10. Repeat steps 6-8 for the regular branch but have the Set property action set the Type property to Regular.





11. Click Save and you’re done!


This method is great for when you need to identify things like subscription types or tiers. Create as many workflows as you like!

But what if you need to parse something a bit more specific than that? Perhaps you have a unique ID for each subscription in your metadata. Are you supposed to create an individual workflow for every single one of them?

Unless you’re immortal, The Flash, or immortal and The Flash, this probably isn’t going to work for you. But if you’re willing to get your hands dirty with some custom code, there’s a pretty quick workaround!


How do you parse Stripe metadata with custom code?


What you’ll essentially be doing, is creating a workflow that separates the key value pairs in the
Subscription metadata property for each subscription into two separate properties! This will allow you to access them a little more easily. And to do this, you’ll need to utilize some custom coding.

Custom coding. If you’re not a programmer, that might sound a little scary. Fortunately you don’t need to be a computer science wiz to get this done. Jonathan Stevens wrote a great blog post to teach you! He’ll walk you through each step of the process. Check it out here.

Isn’t that better?

Want to see what else the app can do? Check out this blog post on Calculating Net MRR With Custom Equations!