Capturing monetization data

This pageapplies toApigee andApigee hybrid.

View Apigee Edge documentation.

Apigee uses the monetization variables for rating, calculating revenue share, and analytics. If you want your Apigee analytics to show the monetization information. By using the monetization variables, you can enhance the monetization capabilities of your transactions.

Monetization variables

The monetization variable names are predefined, and you can't create, edit, or delete the variables. You can assign either request or response variables to the monetization variables.

If you want to override monetization variables, you can do so by capturing them using theDataCapture policy.

This table describes the monetization variables available in Apigee:

Monetization variableData typeDescription
currencyStringSpecifies the currency for calculating the revenue from a transaction.
perUnitPriceMultiplierFloatSpecifies the factor (multiplier) by which the per-transaction cost is multiplied. The per-transaction cost is specified in the rate plan'sConsumption-based fees pricing. The multiplication is performed for a transaction only if the transaction is monetizable. A transaction is monetizable if any one of the following condition is satisfied:
  • If thetransactionSuccess variable istrue.
  • If thetransactionSuccess variable isNULL and themessage.status.code is2xx (success).
revShareGrossPriceFloat

Specifies the revenue of the transaction for calculating the developer's share. Apigee calculates the developer's share only if you have enabled revenue sharing in your rate plan.

transactionSuccessbooleanSpecifies if the transaction should be monetized.
  • If the variable is set totrue, the transaction is monetized.
  • If the variable is set tofalse, the transaction is not monetized.
  • If you don't specify this variable, the transactions are monetization based on the value of the HTTP status code available in themessage.status.code variable. If the HTTP status code of the response is NULL or >=300, a transaction is not monetized; for all other status codes, the transaction is monetized.

Note: If the value oftransactionSuccess is anything other than a boolean, then the DataCapture policy evaluates themint.tx_success_result variable tofalse.
Note:

Value assignment examples

The following examples show how to assign values to the monetization variables:

currency

The following example assigns the value of thebooking[0].currency JSON element in the response to thecurrency variable:

<Capture><Collect><Source>response</Source><JSONPayload><JSONPath>booking[0].currency</JSONPath></JSONPayload></Collect><DataCollectorscope="monetization">currency</DataCollector></Capture>

perUnitPriceMultiplier

The following example assigns the value of thebooking[0].factor JSON element in the response to theperUnitPriceMultiplier variable:

<Capture><Collect><Source>response</Source><JSONPayload><JSONPath>booking[0].factor</JSONPath></JSONPayload></Collect><DataCollectorscope="monetization">perUnitPriceMultiplier</DataCollector></Capture>

revShareGrossPrice

The following example assigns the value of theminPrice variable in the response header to therevShareGrossPrice variable:

<Capture>  <Collect>    <Source>response</Source>    <Header name="minPrice">      <Pattern ignoreCase="true">{$}</Pattern>    </Header>  </Collect>  <DataCollector scope="monetization">revShareGrossPrice</DataCollector></Capture>

transactionSuccess

The following example assigns the value of thebookingStatus variable in the response header to thetransactionSuccess variable:

<Capture>  <Collect>    <Source>response</Source>    <Header name="bookingStatus">      <Pattern ignoreCase="true">{$}</Pattern>    </Header>  </Collect>  <DataCollector scope="monetization">transactionSuccess</DataCollector></Capture>

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-17 UTC.