Yenlo Knowledge Blog

Make Money with APIs using WSO2 API Manager (Part 1)

WSO2’s API Manager supports the Monetization of API’s. In layman’s terms: it allows you to make money with the API’s you or your organization are offering.

For many organizations, monetization is not something they would consider. Governments often offer a service to the public with their API’s. However, API’s can have real value for people or organizations, so much even that they are willing to pay for it. In the Netherlands, the ‘Kadaster’ collects and registers administrative and spatial data on property and the rights involved. Part of the information is free, part is paid. If you want to know what a house has sold for, you can text them with with the zipcode / house / apt number and get the last know sales price. This is only EUR 1.50 and for house buyers this can be valuable information.

So information can be valuable and offering it via API’s can help you make money. So how would you do that using the WSO2 API Manager? In this multipart blog we will help to setup a complete billing environment, show the flow from the API manager to the billing engine and show you how to make money with APIs.

A lot to do

Since this is a bit of configuration, we split the work into a number of blogposts. In this first blog we look at the subscription tiers and how we create an API that users need to pay for.

We will take an out of the box API Manager 2.1.0, install it on Windows (Linux is ofcourse also possible) and work from there. We also deploy the sample PizzaShack API.

Step 1 Turn on Monetization

First thing to do is to turn on monetization. Without this the labels (see further in this blogpost for the intended labels) on the API Store will not be shown. The current API Manager requires you to change the configuration file tenant-conf.json manually, rather then through a specific screen.

We make the changes through the registry browser of the API Manager. So we go the the Management UI of the API Manager (log in on the API Manager for instance https://localhost:9443/carbon) and browse the registry. In the tree select:

_System

Config

Apimgt

Applicationdata

And select edit as text the tenant-conf.json file.

Change the EnableMonetization to true as shown below:

{

"EnableMonetization" : true,

"IsUnlimitedTierPaid" : false,

"ExtensionHandlerPosition": "bottom",

"RESTAPIScopes": {

"Scope": [ …..

If you want the UnlimitedTier to be paid as well, set IsUnlimitedTierPaid to true as well. In order to make the changes permanent, click on Save Content and restart the API Manager.

Step 2 Defining throttling tiers

Let’s add a tier that is commercial. This is done in the admin dashboard of the API Manager (https://localhost:9443/admin) . You add a tier using the button ADD TIER as shown in the bleu bar near the top of the “Subscription tier” screen in the Throttling Policies section.

When we click that we are able to enter details about the new tier. Most fields are self-explanatory but some might need some explanation.

General Details

Name *

Name of the Tier (no spaces allowed)

Description

Description of the Tier

Quota Limits

Request Count / Request Bandwidth

Determines the type of limit

Request Count *

Unit Time *

Minutes / Hours / Days / Weeks / Years

Burst Control (Rate Limiting)

What is the peak that is allows

Request Count

How many requests ?

Policy Flags

Stop On Quota Reach

Yes / No, allows for a model that extra invocations at a additional fee

Billing Plan

Free / Commercial

Custom Attributes

Allows you to add custom attributes to the tier

Permissions

Roles *

Defines the roles for which this tier is

This tier is … for above roles.

Allowed /Denied

Determining the label

With the EnableMonitization set to true we will actually see labels in the API Store. There are the possible labels for an API:

Free

Freemium

Paid

The label that is used is determined by the tiers that are selected when the API is defined.

Let’s look at the three possibilities. We deployed the sample API in API Manager 2.1.0 (PizzaShack) and make changes in the definition.

All free tiers

If we select only free tiers like in the picture below, we get a FREE label on the API.

Mixed tiers

When we mix free and paid tiers we get a FREEMIUM label in the API Store.

Only commercial tiers

If the tiers on the API are all commercial the API will be labeled with a PAID label.

Subscribing on a PAID Tier

Now we have a commercial tier with labels on the API. In the next blog we will go to step two on Monetization, setting up the monetization with a sample backend and so on.

Rob is a Senior Business Consultant and Solution Architect with more than twenty years experience. In addition to his work he is an active blogger working on a number of articles on the ‘Internet of Things’ and a WSO2 ‘Getting Started with …’ series (WSO2 tutorial) in which he talks about WSO2 components and their purpose especially aimed at non technical readers. Rob is a WSO2 expert and official WSO2 trainer.

Hi Rob, thanks for the first part of the tutorial! When will you post the last part? Thanks

Rob Blaauboer

Hi Filipe,
the monetization has changed a bit between v 1.10 and the current version. I will look into it next week hopefully and start writing. In principle it is quite simple, redirect workflow for a commercial tier to a third party engine (in the blogpost this will be either a dummy call or a simple WAR file) and when true complete the signupworkflow.
So a little bit more patience :-)
Rob

Hi Rob, I wanted to know how to set up payment gateway after subscribing to an API. Are you gonna show that too in "Make Money with APIs using WSO2 API Manager (Part 2)"
When will you post the 2nd part? TIA

Uma Patra

And forgot to mention I am following your articles it's very helpful.
Thanks a LOT!!! :-)

Rob Blaauboer

Hi Uma,
Thanks for the comment and compliment.
Was busy with Ballerina this week. Will look into monetization next week,hopefully have a new episode up soon .
Rob