Tutorial: How to monetize an API Product

This tutorial shows you how to define a pricing plan for an API Product, and how API consumers can then subscribe to that monetized Product in the Developer Portal.

Before you begin

To complete this tutorial, you must have the following prerequisites:

About this tutorial

IBM® API Connect includes a subscription billing feature that allows API providers to define pricing Plans in their API Products, and monetize their API offerings. If a Product contains a pricing Plan, API consumers must enter their payment information into the Developer Portal before they can subscribe to that Plan. API Connect supports integration with Stripe Subscription Billing, an independent cloud service that manages monetized product Plans, customers, their payment information, and their subscription history, in order to generate monthly invoices and charge customers automatically. With this integration, Stripe serves as both the subscription billing system and the payment processing system.

Set up your billing resource

Create a Stripe billing integration resource for your provider organization by completing the following steps.

  1. Log in to the API Manager UI.
  2. On the Home page, click the Manage resources tile.
    Manage Resources tile
  3. On the Resources page, select Billing, and click Add.
    Billing Resources page
    The Add billing integration page for Stripe integration is displayed.
  4. Enter a Title for your billing integration, for example My Stripe Billing. Note that the Name is auto-generated based on the Title that you entered.
  5. Enter the test Publishable key and Secret key for your Stripe account. If you don't have a Stripe account, you can create one here: https://dashboard.stripe.com/register. Refer to your Stripe dashboard to get your test API keys: see https://dashboard.stripe.com/apikeys.
    Note: Each Stripe account comes with two sets of API keys, one for testing, and one for production. Each set of API keys has a distinct namespace for Stripe objects. Test API keys cannot see objects created by production API keys, and vice versa. You cannot switch the API keys of one of your billing integrations with the keys from another account, or swap your test and production keys over, as that would prevent API Connect from resolving the Stripe objects that were created by using the old keys. For this tutorial you should use your Stripe test API keys.
    Stripe integration page
  6. Click Add to create your Stripe billing integration resource. The My Stripe Billing integration is now displayed as the billing resource.
    My Stripe Billing integration displayed as the billing resource

Configure a stripe-test catalog

To be able to publish monetized Product Plans, you must add your billing integration resource to a catalog. During this activity you will create a new catalog called stripe-test, so you can delete the catalog at the end of the tutorial if you wish.

  1. In the API Manager, click the Manage icon in the API Manager UI navigation pane Manage icon in the side navigation bar.
  2. Click Add > Create catalog, and create a new catalog called stripe-test.
  3. Click the stripe-test catalog tile, and then click the Catalog settings tab. Select Gateway services and ensure that the catalog is configured to use either a DataPower® Gateway (v5 compatible) or a DataPower API Gateway, or both. Then select Portal, and create a Developer Portal. If you're not sure how to configure these settings, see Creating and configuring Catalogs.
  4. To add the billing integration resource to the catalog, select Billing, and then click Edit.
    Catalog billing view
  5. Select the My Stripe Billing resource that you created earlier, and click Save.
    Selecting My Stripe Billing
    My Stripe Billing is now listed as the billing integration resource for the stripe-test catalog.
    Catalog billing view showing My Stripe Billing

Enable the Stripe payment method in the Developer Portal

To enable API consumers to subscribe to Products with paid Plans, you must configure the Stripe payment method in the Developer Portal for the stripe-test catalog.

  1. Log in to the Developer Portal as an administrator.
  2. If the administrator dashboard is not displayed, click Manage to display it.
  3. In the administrator dashboard, click Extend. The List tab for the Extend page opens, and the list of installed modules is displayed.
  4. Enter Stripe into the search filter, select APIC Monetization Stripe Integration, and click Enable.
    Install screen for APIC Monetization Stripe Integration module
    The default settings for the APIC Monetization Stripe Integration module are now enabled, and you now need to edit those settings.
  5. Click Configuration > System > IBM API Connect Billing.
  6. Change the billing provider module mapping drop-down option to be the newly enabled APIC Monetization Stripe Integration (ibm_stripe_payment_method), and click Save configuration.
    Module mapping screen for APIC Monetization Stripe Integration module
  7. Click Configuration > System > IBM APIC Stripe Integration, and enter the same Stripe test API credentials that you entered for the My Stripe Billing integration resource in Step 5 of Set up your billing resource. Then click Save configuration.
    Setting the Stripe API keys
    The Stripe payment method is now configured in the Developer Portal.

Create and publish a monetized Product

Create a Product that includes a pricing Plan, and publish the Product to the Developer Portal.

  1. First you need to download a test API to use with your Product:
    • If your stripe-test catalog uses a DataPower Gateway (v5 compatible), download the findbranch.txt file to your local filesystem. Rename this file to findbranch.yaml.
    • If your stripe-test catalog uses a DataPower API Gateway, download the findbranch_v6.txt file to your local filesystem. Rename this file to findbranch.yaml.
    Or if you prefer, you can use one of your own APIs.
  2. To import the API into API Manager, click the Develop icon in the API Manager UI navigation pane Develop icon in the side navigation bar, and then click Add > API (from REST, GraphQL or SOAP).
    Add API screen
  3. Ensure that OpenAPI 2.0 is selected, and then select Existing OpenAPI from the Import section, and click Next.
    Existing OpenAPI option
  4. Click Drag and drop files here or click to upload, and select the findbranch.yaml file on your local file system to upload it. Then click Next.
    Validated file is ready to import
  5. Leave Activate API unchecked, as you will activate the API when you publish the monetized Product later in this section. Click Next to continue.
  6. The Summary page displays, showing that the API definition has been generated.
    Summary page showing OpenAPI 2.0 definition has been imported
  7. Click Edit API to see your generated API definition, and then click the Develop icon in the API Manager UI navigation pane Develop icon in the side navigation bar to continue with creating a monetized Product. The FindBranch API should now be shown in your list of APIs - if it isn't, just click the Refresh icon in the API Manager UI navigation pane Refresh icon to refresh your browser.
  8. Click Add > Product
    Develop page showing the FindBranch API
  9. Select New product, and click Next.
  10. Enter FindBranches in the Title field, and click Next.
    Create new product information page
  11. Select the FindBranch API that you imported, or your own API, and click Next.
  12. Accept the defaults for Plans, and click Next. You'll add a priced Plan later.
    Create new product default plan page
  13. Accept the defaults for Publish, Visibility, and Subscribability as well, and click Next.
    Create new product default publish page
  14. The Summary page is displayed, confirming that the new product has been created.
    Create new product summary page
  15. Click Edit product to continue with the configuration.
  16. With the Design tab selected, click Plans in the navigation menu.
    FindBranches Product Plans page
  17. In the Billing integration section, select my-stripe-billing as the billing integration resource.
  18. In the Plans section, click Add to create a new Plan with pricing.
  19. Enter a Title for the new Plan, for example Gold, but leave the Approval checkbox unchecked.
  20. Change the toggle to On for Plan pricing, and the Plan pricing definition section is displayed.
  21. Select Include free trial days, and leave the default of 1 for the number of trial days that a subscriber can use the Plan without charge, after which their billing cycle begins.
  22. Again, leave the defaults of USD - US Dollar for Currency, and 10 for the Price per month to bill the subscriber for.
    Create plan and plan pricing sections
  23. In the Plan rate limits section, change the Calls to be 1000 per hour, to differentiate this Plan from the Default Plan. Click Save to save the new pricing Plan.
    Save Product page
  24. Now you can publish the monetized Product to the stripe-test catalog by clicking the options icon Options icon for the Product , and clicking Publish.
    Publish Product page
  25. Ensure that the stripe-test catalog is selected, and then click Publish.
  26. You can verify that the FindBranches Product is now published by clicking the Manage icon in the API Manager UI navigation pane Manage icon in the side navigation bar, and selecting the stripe-test tile. The FindBranches Product is now listed under the Products tab.
    Product tab for the stripe-test catalog
    Tip: Remember to click the Refresh icon in the API Manager UI navigation pane Refresh icon if the Product isn't displayed.

Verify the publish in your Stripe account

You can verify that the Product Plans were published into your Stripe account by completing the following steps.

  1. Log in to your Stripe test account.
  2. Select Events in the Developer navigation.
  3. Check that events were created when you published the Product plans.

View the monetized Product in the Developer Portal

You can check that the monetized Product is now visible in the Developer Portal by completing the following steps.

  1. Open the Developer Portal for the stripe-test catalog in your web browser. You don't need to log in.
  2. You should see the FindBranches Product on the Home page.
    Developer Portal Home page showing the FindBranches Product
  3. Click the FindBranches tile, and the Plans are displayed, showing both the Default and Gold Plans. You can see the pricing information for the Gold Plan, and if you hover over the text 2 rate limits you can see the rate limit detail. An API Consumer can now subscribe to this monetized Plan.
    Plans page for the FindBranches Product in the Developer Portal showing the Gold Plan pricing information

What you did in this tutorial

In this tutorial, you successfully created and published a monetized Product ready for API Consumer subscriptions. You completed the following activities:

  • Created a Stripe billing integration resource.
  • Configured a stripe-test catalog.
  • Enabled Stripe in the Developer Portal.
  • Created and published a monetized Product.
  • Verified the publish in your Stripe account.
  • Viewed the monetized Product in the Developer Portal.