Configuring monetization on Kubernetes

You can optionally configure monetization in API Connect on a Kubernetes deployment by enabling the billing microservice.

About this task

API Connect includes a subscription billing microservice 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.

Note:
  • These instructions apply only to Kubernetes installations. For VMware installations, see Configuring monetization on VMware.
  • To use Stripe as your credit card processing vendor, you must have port 443 open to HTTPS communication between the Stripe API and your Developer Portal management and the Management cluster servers. See Firewall requirements on Kubernetes and Firewall requirements on VMware for more information about this requirement.
  • Provider organizations cannot add any billing integrations until the billing microservice is enabled.
  • After provider organizations have added billing integrations, the billing microservice must not be disabled.
To enable or disable the billing microservice, you must configure the Management subsystem custom resource (CR) file. See the following instructions:

Procedure

  • Enabling the billing microservice as part of a new deployment

    Edit the CR file for the Management subsystem and add the settings for the billing microservice.

    1. Edit the ManagementCluster CR and add the following definition for the billing microservice. Append the billing definition to the end of the spec: section, making sure to adhere to the spacing used in the file.
      spec:
        ...
        billing:
          enabled: true
    2. Apply the updated CR by running the following command as part of the standard Management subsystem installation (see Installing the Management subsystem cluster for details):
      kubectl apply -f management_cr.yaml -n <management_namespace>
      Where management_namespace is the name of the target installation namespace in the Kubernetes cluster.

      The billing microservice will be enabled with the Management subsystem.

    3. You can monitor your Kubernetes deployments by running the following command:
      kubectl get deployments -n <management_namespace>
      The installation is complete when the management-billing pod is shown in the list of returned values.

    After the billing microservice is enabled, provider organization owners can create billing integration resources for API providers in the API Manager UI. For more information, see Monetizing your Products.

  • Enabling the billing microservice as part of an existing deployment

    Edit the deployed CR for the Management subsystem and add the settings for the billing microservice.

    1. Retrieve the name of the deployed CR for the Management subsystem by running the following command:
      kubectl get managementcluster -n <management_namespace>
      Where management_namespace is the name of the target installation namespace in the Kubernetes cluster.
    2. Edit the deployed CR by running the following command:
      kubectl edit managementcluster <management-cr-name> -n <management_namespace>
      Where:
      • management-cr-name is the name of the deployed CR for the Management subsystem.
      • management_namespace is the name of the target installation namespace in the Kubernetes cluster.
    3. In the editor, append the billing definition to the end of the spec: section, making sure to adhere to the spacing used in the file.
      spec:
        ...
        billing:
          enabled: true
    4. Save the update.

      The billing microservice is enabled in the Management subsystem.

    5. You can monitor your Kubernetes deployments by running the following command:
      kubectl get deployments -n <management_namespace>
      The installation is complete when the management-billing pod is shown in the list of returned values.

    After the billing microservice is enabled, provider organization owners can create billing integration resources for API providers in the API Manager UI. For more information, see Monetizing your Products.

  • Disabling the billing microservice
    Important: After provider organizations have added billing integrations, the billing microservice must not be disabled.

    Edit the deployed CR for the Management subsystem and update the settings for the billing microservice.

    1. Retrieve the name of the deployed CR for the Management subsystem by running the following command:
      kubectl get managementcluster -n <management_namespace>
      Where management_namespace is the name of the target installation namespace in the Kubernetes cluster.
    2. Edit the deployed CR by running the following command:
      kubectl edit managementcluster <management-cr-name> -n <management_namespace>
      Where:
      • management-cr-name is the name of the deployed CR for the Management subsystem.
      • management_namespace is the name of the target installation namespace in the Kubernetes cluster.
    3. In the editor, change the billing definition to enabled: false.
      spec:
        ...
        billing:
          enabled: false
    4. Save the update.

      The billing microservice is disabled in the Management subsystem.