Need Assistance with Monetization Reports in Apigee X

Dears,

I'm looking for an expert advice on generating monetization reports in Apigee X. I'm relatively new to Apigee, and I've been following the documentation to set up monetization in my free trial account as part of a POC.

I successfully completed the steps mentioned in the documentation and managed to generate a revenue report. However, I am experiencing an issue, some of the metrics I expected to see in the report are not populated. Kindly check the screenshot belowmissing metrics.pngThese metrics are closely tied to monetization variables (currency, perUnitPriceMultiplier, revShareGrossPrice, transactionSuccess), and I suspect the issue might be related to how I'm capturing these variables using the data capture policy. I followed the guidance provided in this link, but I'm facing challenges when it comes to assigning the variables within the data capture policy. I didn't observe these variables being populated during execution phase. Attached the screenshot of the debug session below for reference.debug trace.pngFurther, I have configured one-time initialization fees and recurring fees in one of my rate plans. However, these values are not being populated in the fee columns of the revenue report, as expected.

Rate plan settings:revenue rate plan.pngThis rate plan is associated with the RetailRevenueSharingProduct, as shown in the first screenshot. Below is the policy implementation of RetailRevenueSharing Proxy.

 

 

 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ProxyEndpoint name="default">
  <Description/>
  <FaultRules/>
  <PreFlow name="PreFlow">
    <Request>
      <Step>
        <Name>VA-VerifyKey</Name>
      </Step>
      <Step>
        <Name>MC-EnforceMonetization</Name>
      </Step>
      <Step>
        <Name>Q-ImposeQuota</Name>
      </Step>
    </Request>
    <Response/>
  </PreFlow>
  <PostFlow name="PostFlow">
    <Request/>
    <Response/>
  </PostFlow>
  <Flows>
    <Flow name="getCategories">
      <Description>Get all categories</Description>
      <Request/>
      <Response/>
      <Condition>(proxy.pathsuffix MatchesPath "/categories") and (request.verb = "GET")</Condition>
    </Flow>
    <Flow name="getCategoryById">
      <Description>Get a specific category</Description>
      <Request/>
      <Response/>
      <Condition>(proxy.pathsuffix MatchesPath "/categories/{categoryId}") and (request.verb = "GET")</Condition>
    </Flow>
    <Flow name="getStores">
      <Description>Get all stores</Description>
      <Request/>
      <Response/>
      <Condition>(proxy.pathsuffix MatchesPath "/stores") and (request.verb = "GET")</Condition>
    </Flow>
    <Flow name="getStoreById">
      <Description>Get a specific store</Description>
      <Request/>
      <Response/>
      <Condition>(proxy.pathsuffix MatchesPath "/stores/{storeId}") and (request.verb = "GET")</Condition>
    </Flow>
    <Flow name="getProducts">
      <Description>Get all products</Description>
      <Request/>
      <Response/>
      <Condition>(proxy.pathsuffix MatchesPath "/products") and (request.verb = "GET")</Condition>
    </Flow>
    <Flow name="getProductById">
      <Description>Get a specific product</Description>
      <Request/>
      <Response/>
      <Condition>(proxy.pathsuffix MatchesPath "/products/{productId}") and (request.verb = "GET")</Condition>
    </Flow>
    <Flow name="updateProductById">
      <Description>Update a specific product</Description>
      <Request/>
      <Response/>
      <Condition>(proxy.pathsuffix MatchesPath "/products/{productId}") and (request.verb = "PATCH")</Condition>
    </Flow>
    <Flow name="createOrder">
      <Description>Create a new order</Description>
      <Request/>
      <Response/>
      <Condition>(proxy.pathsuffix MatchesPath "/orders") and (request.verb = "POST")</Condition>
    </Flow>
    <Flow name="getOrderById">
      <Description>Get a specific order</Description>
      <Request/>
      <Response/>
      <Condition>(proxy.pathsuffix MatchesPath "/orders/{orderId}") and (request.verb = "GET")</Condition>
    </Flow>
    <Flow name="deleteOrderById">
      <Description>Delete a specific order</Description>
      <Request/>
      <Response/>
      <Condition>(proxy.pathsuffix MatchesPath "/orders/{orderId}") and (request.verb = "DELETE")</Condition>
    </Flow>
  </Flows>
  <HTTPProxyConnection>
    <BasePath>/revenuesharing/retail</BasePath>
    <Properties/>
    <VirtualHost>default</VirtualHost>
  </HTTPProxyConnection>
  <RouteRule name="default">
    <TargetEndpoint>default</TargetEndpoint>
  </RouteRule>
</ProxyEndpoint>

 

 

Any assistance would be greatly appreciated.

@dknezic @dchiesa1 @kurtkanaskie 

1 1 164
1 REPLY 1

Hi @SurajKamal,

You are missing one crucial step, that is using the DataCapture policy to capture the values for the 4 special Monetization variables. In my example, I set headers for those values so I can see them in the response. I use those values in the DataCapture policy in the PostFlow response like this:

 

<DataCapture name="DC-monetization">
    <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
    <Capture>
        <Collect ref="response.header.x-monetization-currency" default="USD"/>
        <DataCollector scope="monetization">currency</DataCollector>
    </Capture>
    <Capture>
        <Collect ref="response.header.x-monetization-success" default="false"/>
        <DataCollector scope="monetization">transactionSuccess</DataCollector>
    </Capture>
    <Capture>
        <Collect ref="response.header.x-monetization-multiplier" default="1"/>
        <DataCollector scope="monetization">perUnitPriceMultiplier</DataCollector>
    </Capture>
    <Capture>
        <Collect ref="response.header.x-monetization-revenue-share-price" default="0"/>
        <DataCollector scope="monetization">revShareGrossPrice</DataCollector>
    </Capture>
</DataCapture>

 

Also, you'll need to set values for those variables, I don't see that anywhere either. For each of my responses, I set them like this:

 

<AssignMessage async="false" continueOnError="false" enabled="true" name="AM-ping-response">
    <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
    <Set>
        <Headers>
            <Header name="X-Monetization-Multiplier">1</Header>
            <Header name="X-Monetization-Revenue-Share-Price">1.0</Header>
            <Header name="X-Monetization-currency">USD</Header>
            <Header name="X-Monetization-success">true</Header>
        </Headers>
...

 

Note the use of: "X-Monetization-success" this controls whether or not you charge for the API call. 

Give that a try and run your report again.