Enabling Apigee monetization

This page applies to Apigee and Apigee hybrid.

View Apigee Edge documentation.

Before you can use Apigee monetization, you must purchase and enable it in your organization.

Purchasing Apigee monetization

To purchase Apigee monetization for subscription-based organizations:

  1. Verify that Apigee monetization is included in your Apigee subscription. See Apigee entitlements.
  2. Contact Apigee Sales to purchase Apigee monetization if needed.

Enabling Apigee monetization in your organization

To enable Apigee monetization in an existing organization, issue a POST request to the following API, passing the add-on configuration in your request body:

https://apigee.googleapis.com/v1/organizations/$ORG:setAddons

For example:

curl "https://apigee.googleapis.com/v1/organizations/$ORG:setAddons" \
  -X POST \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-type: application/json" \
  -d '{
    "addonsConfig": {
      "monetizationConfig": {
          "enabled": "true"
      }
      <Include existing add-on configuration>
    }
  }'

Where $TOKEN is set to your OAuth 2.0 access token, as described in Obtaining an OAuth 2.0 access token. For information about the curl options used in this example, see Using curl. For a description of the environment variables used, see Setting environment variables for Apigee API requests.

The following provides an example of the response showing that the operation is in progress:

{
  "name": "organizations/$ORG/operations/1ae3ed56-b38f-4cc1-ba33-e7d89557075d",
  "metadata": {
    "@type": "type.googleapis.com/google.cloud.apigee.v1.OperationMetadata",
    "operationType": "UPDATE",
    "targetResourceName": "organizations/$ORG",
    "state": "IN_PROGRESS"
  }
}

For more information, see the Configure organization add-ons API.

View the organization profile to confirm that monetization has been enabled. For example:

curl "https://apigee.googleapis.com/v1/organizations/$ORG" \
  -X GET \
  -H "Authorization: Bearer $TOKEN"

The following provides an example of the response showing monetization is enabled.

{
    "name": $ORG,
    ...
    "addonsConfig": {
    "monetizationConfig": {
      "enabled": true
    }
  }
}

Disabling Apigee monetization in your organization

To disable Apigee monetization in your organization, issue a POST request to the following API, passing the add-on configuration in your request body:

https://apigee.googleapis.com/v1/organizations/$ORG:setAddons

For example:

curl "https://apigee.googleapis.com/v1/organizations/$ORG:setAddons" \
  -X POST \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-type: application/json" \
  -d '{
    "addonsConfig": {
      "monetizationConfig": {
          "enabled": "false"
      }
     <Include existing add-on configuration>
    }
  }'

The following provides an example of the response showing that the operation is in progress:

{
  "name": "organizations/$ORG/operations/06274ffb-8940-41da-836d-781cba190437",
  "metadata": {
    "@type": "type.googleapis.com/google.cloud.apigee.v1.OperationMetadata",
    "operationType": "UPDATE",
    "targetResourceName": "organizations/$ORG",
    "state": "IN_PROGRESS"
  }
}

For more information, see the Configure organization add-ons API.

View the organization profile to confirm that monetization has been disabled. For example:

curl "https://apigee.googleapis.com/v1/organizations/$ORG" \
  -X GET \
  -H "Authorization: Bearer $TOKEN"

The following provides an example of the response showing monetization is enabled.

{
    "name": $ORG,
    ...
    "addonsConfig": {
    "monetizationConfig": {
      "enabled": false
    }
  }
}

Troubleshooting Apigee monetization enablement

If you have not purchased Apigee monetization and you attempt to enable it, the following error is returned:

{
  "error": {
    "code": 400,
    "message": "failed to validate addons config: [Apigee Monetization] addon(s) are not entitled to the subscription",
    "status": "FAILED_PRECONDITION"
  }
}