Charging For API Usage By Unique User
When it comes to monetizing APIs, there are a lot of ways you can do it. One popular way to do so is to charge based on how many unique users are utilizing your API. A good example would be charging $7 per month for each user using your API. For a company with five users accessing the API in a given month, their monthly statement would show a charge of $35 (plus any applicable taxes).
Implementing this can be challenging; however, a solution like Moesif can help you build and deploy a monetization model in a matter of minutes. Let’s look at how it can be done..
To follow the steps below, you must integrate your APIs with Moesif. Check out our integration documentation for more details on integrating your APIs with Moesif.
Create the Plan and Price
The first thing we must do is create a plan and price in Moesif so that usage can be accurately tracked against it. Set up a plan in Moesif:
- Log into Moesif and navigate to the Product Catalog from the left-side menu.
- On the Plans screen, click Create New in the top-right corner.
- On the Create New Plan screen, fill in the following details:
- Plan name: the name of your plan, such as “My API Plan”.
- Billing Provider: select Stripe from the dropdown menu
- Click Create in the top-right corner.
An example of what the plan would look like in Moesif is shown below.
With your plan created, we can move on to creating a price for the plan. To create a price, do the following.
- Under the Product Catalog menu item on the left side of the screen, click Prices.
- On the Prices screen, click the Create New button in the top-right corner.
- On the Create New Price screen, fill in the following details:
- Price name: This is the name of our price, such as “Per User Price”
- Price ID: Leave this blank, as it will be auto-generated by Stripe.
- Linked Plan: Select the plan we created in the previous step.
- Pricing Model: Set this to “Package (Per Unit)”
- Measure Usage as: Set this as “Max of” unit(s) used every “Month”, in “$USD”.
- Pricing Structure: Set this as “$7.00” per “1” unit(s).
- Tax Structure: Set this to Auto.
- Click Create in the top-right corner.
An example of what the price would look like in Moesif can be seen below.
Now that we have our plan and price in Moesif, we can create our Billing Meter to track usage and attribute it to the plan.
Create the Billing Meter
By creating a Billing Meter in Moesif, we will create a mechanism to meter API usage and derive how many unique users are accessing the APIs. To make a Billing Meter in Moesif to track unique users, we will do the following:
- Go to the Billing Meters screen by clicking the corresponding menu item in the left-side menu.
- On the Billing Meters screen, click the Add Billing Meter button in the top-right.
- Once on the New Billing Meter screen, fill in the following details:
- Give the meter a name in the text input at the top of the screen
- In the Link To > Billing Provider dropdown, select “Stripe”, then select the plan and price created in the previous step.
- Under Filter, we will add two criteria:
- Events where “User Id exists”
- Events where “Event Type is API Call”
- In the Metrics dropdown, select Uniques > Unique Users.
- Click Create in the top-right corner to create the Billing Meter.
An example of how this would look in Moesif can be seen below.
With the billing meter created and active, unique users will now be metered and reported to the subscription in Stripe so usage can be charged accurately.
Try It Out
As you can see from our above demonstration, this billing model is easy to implement with Moesif and Stripe. In a matter of minutes, you can begin to meter usage and report it to Stripe (or another billing provider of your choice) to accelerate your API monetization journey. Want to monetize your APIs quickly and effectively? Give Moesif a try by signing up or connect with our team of API monetization experts.