Enabling API Monetization with Moesif
As an API provider, you probably picture bringing in some type of revenue as part of your API business model. When you first begin the journey of monetizing your API product, you’ll likely find that the complexities of monetization run deep. Much of the time, solving this problem extends beyond the capabilities of a typical API gateway or API management platform. When thinking about how to recover revenue from API usage, questions begin to pop up, such as “will you charge per API call or per user?” or “how do I block API users from using an API if they have an overdue invoice?”. To solve these issues, a lot of customization, testing, and support is required. Luckily, with Moesif, it’s extremely simple to create a smooth journey for users with end-to-end monetization offered through the platform. Moesif can be used as an API monetization platform that offers a massive amount of flexibility. It also offers other tools that can supplement your user journey, drive API adoption, and improve your API product. Implementing usage based pricing can diversify your revenue stream and allow for new, direct monetization campaigns.
Let’s take a look at how you can use Moesif to bring in revenue by implementing an API revenue model with Moesif’s API monetization capabilities.
Billing Providers
Depending on your exact use case, you may have a preference towards which billing provider will best fit your needs. Currently, Moesif supports 3 different billing providers. The billing providers include:
- Stripe
- Recurly
- Chargebee
Each of these platforms has its own advantages and disadvantages. To explore more about that, check out this great article which goes over all the intricacies of each platform. Depending on your API monetization model, you may find that one or more of these platforms will support your use case.
With Moesif, these billing providers are connected to Moesif so that usage data can be sent to the provider and so that the provider can also send data back to Moesif, such as invoice details or subscription updates. By using Moesif to send billing data to the provider and receive data back, Moesif can play a pivotal role in the overall revenue leakage prevention of your APIs and allow for easy configuration and maintenance/troubleshooting.
Billing Meters
Once you’ve connected Moesif to a billing provider, you will have the ability to create billing meters. Billing meters do two main things:
- Let you create a filter that will monitor and tally up API usage
- Send the usage of your API resources to the selected billing provider
Moesif is the optimal spot to initiate your billing flow since it has all of the data from your API calls as well as the capabilities to create sophisticated criteria for billing.
To create a billing meter, simply log into Moesif and navigate to the Billing Meter screen from the left-side navigation. From there, click on the Add Billing Meter button.
On the next screen you can set up the filter you would like to use to specify which traffic you’d like to bill on. For example, we could set up a filter for a specific endpoint and status code, such as only billing for API calls to the /myservice endpoint that receive a 200 OK response status code. You’ll also select the metric to bill on at this point. We will choose Event Count for this one so that every single API call will be counted as one unit but other options are also available including billing by Unique Users, Response Body Count, or using a Custom Metric.
You’ll also need to make sure to have the billing providers configured in Moesif. This can be done in as little as 5 minutes! Curious about how easy it is? Check out our guides on how to do it with Stripe, Recurly, and Chargebee. Once the Billing Meter is created, API usage will then be automatically synced over to the Billing Provider you’ve selected for the billing meter. In a matter of minutes, you’ll have monetized APIs that leverage metered billing through Moesif. For more indepth examples, check out our end-to-end guides using Kong, Tyk, and Node.
Governance Rules
Monetizing APIs is one thing but controlling access based on billing status is another. In general, best practices dictate communication with your users to keep them aware of their API consumption levels. If a user has an overdue invoice or has exceeded their approved spend, you may want to suspend their access. This can be done in Moesif using Governance Rules. Governance Rules are easy to set up. Simply navigate to the Governance Rules screen and click Add New.
We will then add a new User Rule.
On the next screen, will configure the rule to block users who belong to the Users with Unpaid Invoices cohort. We will return a response with a 402 - Payment Required response code and a Response Body that outlines the problem.
Once this Governance Rule is created, it will effectively block the users from accessing the API until their invoice is settled. For Pre-paid scenarios, you could also use a Governance Rule to block calls when a user’s credit balance reaches $0. To look at this pre-paid scenario in more detail, check out our blog on pre-paid billing with Moesif.
2 important notes when it comes to Governance Rules in Moesif. Firstly, Governance Rules are an enterprise plan feature so you will require an enterprise subscription. Secondly, not all SDKs and Plugins support governance rules. Please verify that your specific setup and plan will support governance rules before trying to implement them.
Behavioral Emails and Alerts
Although optional, using Moesif’s behavioral email and alert capabilities can augment the experience your users have with your monetized APIs. Both of these features use a customizable filter to establish the conditions in which the email or alert should be sent.
Behavioral emails can be used to guide users as they sign up for your APIs, notify them of issues that may be occurring and how to fix them, or in the case of a monetized API, let a user know that they have an outstanding invoice that is blocking their API access.
As an example, we can set up a behavioral email that will send when an API consumer tries to access an API with an unpaid invoice. To do this, navigate to the Behavioral Emails screen and select Create Template.
From here we will fill out the details and create a simple email letting the user know that their API access has been suspended due to an outstanding invoice and how to pay it.
Once the email is created, whenever a user becomes part of the Users with Unpaid Invoices cohort, they will automatically be sent an email to help them regain access to the API.
Alerts can be used to alert internal teams about events such as users experiencing a high number of errors or issues with integration. In terms of API revenue though, you could go further to use alerts to let sales and customer success teams about certain conditions that might require outreach or allow for a possible upsell opportunity.
Going along with the example from above, we could also alert the Customer Success team (or the accounting team, pending they are responsible for following up on overdue accounts) to let them know that a customer may need assistance settling an overdue invoice. To create an Alert, navigate to the Alert Rules screen and select + Alert Rule.
From here we will configure the alert to send to our support teams email whenever someone with an unpaid invoice tries to access the API more than 5 times in a 15-minute time period.
Once the alert is activated, our customer success team will then be notified. Of course, there are also ways to alert through SMS, Slack, PagerDuty, or custom Webhook configuration. More information on Alert Rules can be found in the docs.
Try it out!
Implementing a monetization strategy has always been a tough hurdle to get past. Many custom solutions offered flexibility but at a very high engineering and support cost. With Moesif, setting up an API monetization model to generate additional revenue is possible in an extremely minimal amount of time. As demonstrated in this article, With a little bit of configuration and a minimal amount of code we can create a revenue generating API in minimal time.
On top of that, supporting customers is even easier with Governance Rules, Behavioral Emails, and Alerts to guide and give any customer a great experience. Moesif is the most flexible and easy-to-use end-to-end API monetization product on the market. Wanna give it a try? Sign up today to create a pricing model for your APIs and building your API revenue in a matter of minutes.