At Chargebee, we constantly look out for ways to make the handling subscriptions & billing, efficient.

Beyond the skeletal data, there’s sometimes a need to store additional information about a particular resource.

Often, we see that most of our customers resort to storing such additional key subscription information in their databases.

But following this route might become a challenge in some cases, like these:

  • Your SaaS application should know which features to offer, based on the plan the customer is on. Over time, when you run multiple pricing experiments and decide to honor prices for the existing customers (grandfathering), the process becomes extremely complex and downright messy.
  • Your sales team must know if a customer has used a coupon before, or simply has used a trial earlier.
  • When your marketing team needs data on whether a customer opted in for marketing promotions, if they’re part of a marketing campaign, etc. There should be a simpler way to access it from within the same app rather than flitting between the CRM and spreadsheets!

A typical solution would be to model this information along with your core application or write a middleware, which breaks the whole experience of how you manage subscriptions efficiently.

With Chargebee, however, you have a much easier way to manage this information.

Introducing our new metadata support, where you can store all the essential information right within Chargebee. You can directly push in key value pairs, adding more context to Subscriptions, Customers, Plans, and more, to suit your business needs.

The information specific to each object can be stored in Chargebee, and you can add/update this information in simple JSON format.

curl  https://api.chargebee.com/api/v2/customers 
     -u api_key: 
     -d first_name="John" 
     -d last_name="Doe" 
     -d email="john@test.com" 
     -d meta_data='{"allows_marketing":"yes","marketing_channel":"organic"}'

With metadata you can add more information in a complex configuration as opposed to a pre-defined structure of custom fields that Chargebee supports. Also, metadata supports adding information from across various resources such as Customers, Plans, Coupons, etc. If you’re looking for a simpler way to add extra information just for the Customer resource, however, try custom fields.

Here are a few more business cases for which metadata can be used:

  • If you’d wish to tease users to try specific features as “trials” before they upgrade, Like Positionly, you can identify that at the customer level by storing the information as a metafield.
  • If you’d want to run specific campaigns and give away a few thousand free emails for specific coupons, Like Sendgrid, you can do that by simply storing that information in the coupon’s metafield metadata.

Like our approach? Have any suggestions? Let us know what you think.