Dears, I hope you are doing well,
We are implementing Apigee Monetization (OPDK) and have a requirement where an API receives requests for different services, each with its own price. The requested service is passed in the body of the request, and each request contains only one service.
Here is the service-level pricing:
Example Request Format:
We would like your recommendation on the best practice for implementing this pricing model using Apigee Monetization (OPDK), specifically how to:
Note: This is only for POSTPAID developers.
We are open to any recommended architecture or implementation pattern, including usage of custom attributes, API product configurations, or rate plans.
Please advise on how to approach this requirement effectively. Let us know if additional context is needed.
Thank you,
Solved! Go to Solution.
Hi @Amr
I think you an accomplish what you want using a custom attribute in the Transaction Recording Policy of the Product Bundle. For example, I set a flow variable "delivered_count" to represent the count I want to use to multiply the rate from the rate plan in the response.
My Rate Plan
Then in an Assign Message for my response I set the value of the "delivered_count" variable.
<AssignMessage async="false" continueOnError="false" enabled="true" name="AM-create-status-response">
<DisplayName>AM-create-status-response</DisplayName>
<AssignVariable>
<Name>delivered_count</Name>
<Value>5</Value>
</AssignVariable>
<Set>
<Headers>
<Header name="Content-Type">application/json</Header>
<Header name="X-monetization-status">OK</Header>
</Headers>
<Payload contentType="application/json">
{
"developerEmail":"{developer.email}",
"application": "{verifyapikey.VA-header.developer.app.name}",
"product": "{verifyapikey.VA-header.apiproduct.name}",
"apiproxy": "{apiproxy.name}",
"apiproxyRevision": "{apiproxy.revision}",
"basepath": "{proxy.basepath}",
"suffix": "{proxy.pathsuffix}",
"message":"STATUS",
"delivered_count":{delivered_count}
}
</Payload>
<StatusCode>200</StatusCode>
<ReasonPhrase>OK</ReasonPhrase>
</Set>
</AssignMessage>
The result is that the developer will be charged 5 X $0.05 = $0.25 for this call.
In your use case, you could create a rate plan with a rate of $1.00 for a limited band and $1.00 for unlimited calls.
Then set a flow variable (e.g. delivered_count) for each flow cost (e.g. 3, 5 and 8).
Hope that helps.
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |