Bookmark this page

Chapter 7. Monetizing APIs with Red Hat 3Scale API Management

Abstract

Goal Monetize APIs by configuring billing plans and pricing rules.
Objectives
  • Configure billing for API consumers.

  • Configure pricing rules for APIs.

Sections
  • Configuring Billing for APIs

  • Configuring Billing for APIs (Guided Exercise)

  • Configuring Pricing Rules for API Consumption (and Guided Exercise)

  • Monetizing APIs with Red Hat 3Scale API Management (Quiz)

Configuring Billing for APIs

Objectives

After completing this section, you should be able to configure billing for API consumers.

Billing in Red Hat 3scale API Management

With 3scale API Management you can set up billing and handle customer payments, either manually or automatically.

3scale API Management billing generates a monthly invoice for the customer based on the application plans the customer signed up for. Customers in 3scale API Management are the developer accounts that signed up to use your APIs.

To configure billing in the Admin Portal navigate to the Audience page. There you can access the Billing menu.

Automatic billing is enabled by default for all the accounts. You can disable automatic billing for individual accounts by navigating to the account and clicking Disable in the billing section from the account details page.

You can enable automatic payments globally. For this, you must navigate to Billing > Settings > Charging & Gateway and click Charging enabled. This affects every developer account in the tenant, but you can disable it for individual accounts in the billing section from the account details page.

To use automatic payments you must configure a payment gateway. 3scale API Management offers integration's with credit card gateways like Stripe or Braintree.

Billing Configuration

To configure billing, navigate to Billing > Settings > Charging & Gateway.

There you have the following options to customize the invoices that 3scale API Management sends to customers.

Mode

You can select Prepaid or Postpaid depending on which month you want clients to pay in the current month invoice.

Charging enabled

You must enable this if you want to have automated payments by using a payment gateway.

Currency

You can pick the currency for the invoice. If you set up automatic payments, pick a currency supported by your payment gateway.

Invoice footnote

The text you provide shows at the bottom of every PDF invoice.

Text to show if VAT/Sales Tax is 0%

The text that shows when VAT/Sales Tax is explicitly set to 0.

Billing periods for invoice IDs

Invoice identifier format used for administrative purposes. You can set it to monthly or yearly string formats, which correspond to YYYY-MM-XXXXXXXX and YYYY-XXXXXXXX respectively. This setting only affects the formatting of the identifier. Only automated monthly billing is supported.

Managing Invoices

You can list and search the existing invoices by navigating to BillingInvoices.

Figure 7.2: Invoice list

From the invoice list you can see some invoice details like identifier, the developer account, and the invoice state.

In 3scale API Management an invoice can be in the following states.

Open

The invoice is created and the invoice contents can be updated.

Finalized

The invoice has all the current billing period charges added to it.

Pending

3scale API Management issued the invoice to the customer and the invoice is awaiting payment.

Unpaid

The invoice payment failed, but the system will retry.

Paid

The invoice payment terminated with success.

Failed

The invoice payment failed after several attempts and 3scale API Management stops retrying.

Canceled

The administrator canceled the invoice.

Billing Modes and the Billing Process

3scale API Management offers two billing modes:

Prepaid

3scale API Management bills fixed and set-up fees at the beginning of the month. Variable costs for the current month are billed at the beginning of the following month.

Postpaid

3scale API Management bills all the fees at the beginning of next month.

The billing process executes every day. The tasks to execute differ depending on whether it is the the first day of the month, and whether the billing mode is set to prepaid or postpaid.

The following tasks execute the first day of the month:

  • Prepaid

    • Bill fixed costs for current month.

    • Bill variable costs for previous month.

    • Finalize the invoice for the current month.

  • Postpaid

    • Bill variable cost for previous month.

    • Finalize open invoices for the previous month.

    • Create an open invoice for this month and bill fixed costs.

The following tasks execute every day of the month, including the first day:

  • Create an open invoice for today's new contracts and expired trials.

  • If the payment method is prepaid, finalize invoices with an open state.

  • Issue invoices to customers and change the state from finalized to pending.

  • Charge invoices. Invoices in an unpaid and pending state are charged if the Due On invoice property is set for today or earlier. A failed payment changes the state to unpaid. After three failed payment attempts the invoice is set to failed.

  • Notify the credit cards that are about to expire.

You can manually trigger these tasks from the Admin Portal. For this, navigate to the selected invoice by clicking the invoice identifier in the invoice list. If the selected invoice is not paid you can perform different actions. For example, if the invoice is open then you can issue the invoice by clicking Issue invoice and leave it in a pending state.

Revision: do240-2.11-40390f6