It’s always great to build something that makes money. The most successful businesses often find the easiest and most efficient ways to make money, while keeping costs and support to a minimum. After all, the best businesses and products are simply the ones that know how to build revenue. Many companies now look to monetizing their APIs as part of their overall monetization strategy.
API monetization isn’t always easy though. It generally takes a lot of integrations, a fair amount of code and customization, and can also lead to a large support burden. This is especially true when billing issues arise. In short, there are challenges both during implementation, and once the billing system is up and running.
What if a simpler approach was possible? At Moesif, we recently introduced a feature for Billing Meters. This is a way to use the data coming into Moesif to monitor usage for a user, send this data to a billing provider, and have the users be presented with accurate bills, all with a fraction of the work required to implement a custom solution.
To illustrate how it works, let’s assume we have an API that we would like to charge customers to use. As an example, let’s pretend that we have created a new credit score API that companies can use to bring consumers’ credit ratings back to their app. Our API will be /RetrieveCreditScore, and users will be charged for each query/call they send to the endpoint.
Our API monetization model will be pretty simple. We will have 3 usage tiers that will determine how much the users will be charged:
- 1-100 queries per month ($5 per query)
- 101-1000 queries per month ($3 per query)
- 1001+ queries per month ($2 per query)
This tiered pricing schema is quite common, where the more the service is used, the larger the discount is.
Recurly will be the billing provider that we will use to invoice and charge customers for their usage. Recurly is simple to use and will allow us to easily set up plans and add-ons to adhere to the pricing scheme above.
We will now use Moesif to tally up the usage for the endpoint and send the usage metrics to Recurly. Recurly can then use these metrics to bill the customer accordingly, based on the tier that their metrics coincide with, and collect payment.
Integrate your app and APIs with Moesif
In order to use the Billing Meters feature in Moesif, you need to have your APIs integrated with Moesif. This is because Moesif will use the metrics stored within it and then feed Recurly the info it needs. Once your APIs are integrated with Moesif, you can also use other features which pair well with our Billing Meters feature, including behavioral emails, governance rules, and alerts.
If you are not currently using Moesif to monitor your APIs, integration can be done in a few different ways. If you are using an API gateway or API management platform, you can use one of our many plugins which allow you to quickly feed analytics to Moesif. If you are not using a third-party gateway or management platform, or want to do it at the API code level, you can use one of our SDKs. A Moesif SDK will allow you to easily integrate Moesif with your Node, Python, or Java APIs (plus many, many more languages and frameworks) directly from your code. Either way is easy and simple to support.
Another Moesif feature that you need to deploy in order to make billing work correctly, is to implement user and company tracking. Generally, this can be set up in a few simple steps. We need this feature enabled so that usage data in Moesif can be tied to specific users and companies. This is how Recurly will map usage to a customer within Recurly, so they can be billed accordingly.
Once you have integrated with Moesif, and have user and customer tracking enabled, your next step would be to actually create your plans in Recurly, so they can be used in Moesif.
Create plans and add-ons in Recurly
After creating a Recurly account and logging in, you can begin to create your plans. For our purposes, we need to create a plan which includes an add-on that uses tiered pricing.
You’ll need to create a plan in Recurly which is post-paid (payment received at the end of the billing cycle), and the price is per unit. Aside from that, for our pricing scheme, we will create an add-on that has a tiered pricing scheme. It would look like this in Recurly:
Now, at the end of the month, when Recurly creates the invoice, it will do so based on these tiers. Of course, at this point, we only have the plans defined, but no one will be charged since we don’t yet have any usage data being sent to Recurly.
% include cta_section.html excerpt=’Integrate Metered Billing Easily’ image=’/images/posts/cta/cta-monitoring.svg’ button_text=’Learn More’ url=’https://www.moesif.com/solutions/metered-api-billing?utm_campaign=Int-site&utm_source=blog&utm_medium=body-cta&utm_term=monetize-with-recurly’ %}
Integrate Recurly with Moesif
We still need to actually get the data from Moesif over to Recurly, and vice versa. There are two mechanisms that are used for this: a webhook and the Recurly API. Each has a distinct part in facilitating the data sharing between the platforms.
By adding the webhook into Recurly, subscription updates can be sent back to Moesif. By using the Recurly API, Moesif can send usage details to Recurly and can also retrieve details about available plans and add-ons in Recurly. These two points of contact are all that’s needed for the Recurly and Moesif integration. Thankfully, Moesif walks you through this when you set up Recurly as a billing provider and provides all the needed details. For the specifics, you can also check out our docs on the Recurly integration.
Set your billing parameters
Once you’ve integrated Recurly in Moesif, you can set up your billing meter. For our example, it will be very simple. What we will do is send usage metrics to Recurly whenever an API call to /RetrieveCreditScore returns a “200 OK” response. This means we will only bill for successful calls and won’t accidentally charge for calls where an error was experienced.
Once we create the billing meter, every hour the usage for each customer will be sent to Recurly. At the end of the month, Recurly will create an invoice based on our tiered price structure and bill the user.
You can also use Moesif to automatically send behavioral emails for every successful call, or even if they are about to cross into the next discount tier. You could also use Moesif’s Governance Rules to block users with overdue invoices from accessing the API until their invoice is settled.
Try it out for yourself
As you can see, you are just a few steps away from robust API monetization that is simple to implement and support. By using Moesif and Recurly together you’ll be able to charge customers for usage in a matter of minutes, manage subscriptions, and can even use other Moesif features to create the ultimate customer experience. Our billing setup is so simple that it can even be done without having any developer skills.
The Billing Meters feature is available for all Moesif users. Sign up for Moesif today to instantly access our Billing Meters feature to begin billing for your customers’ API usage. If you’re already using Moesif, click on Billing Meters in the left-side navigation menu and take a look at our docs to show the exact steps to get you to monetize your APIs.