Monetizing service invocations
You can set the cost of a service's invocation through a monitor rule.
This price gets logged as the invokeCost property of invoke documents.
And using the MonitorMethods.getMonetizationBill(...) function, you can compute the total cost of
a given set of invoke documents (selected through a query).
In this section, we'll explore how to apply advanced monetization (costs) based on these rules.
Monitor rules have a field called Callback Service. This corresponds to the
service that needs to be invoked when a request is matched and executed successfully. You can use this
facility to implement custom logic for computing the pricing schemes according to your organization's requirements.
Below is a service that adds a 1.5x surcharge to requests sent outside of working hours:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 | |
InvokeDocument.Builder
In this example, we set a new cost for our InvokeDocument through the
InvokeDocument.Builder's invokeCost(int) method.
Aside from invokeCost, you can configure other document properties through the builder.