Calculate revenue using pricing rules
1 min
POST
https://app.amberflo.io/payments/analysis/by-rule-revenue-calculator
Body Parameters
- bodypayment.analysis.modeling.by_rule.ByRulePriceAnalysisModel.inDescription
- keypayment.analysis.modeling.PriceAnalysisModelKey.inDescription
- accountIdstringDescription
- idstringDescription
- typestringDescriptionDefaultby-rule
- namestringDescription
- descriptionstringDescription
- timeRangepayment.common.TimeRange.inDescription
- startTimeInSecondsinteger<int64>Description
- endTimeInSecondsinteger<int64>Description
- analysisProductPlanspayment.analysis.modeling.AnalysisProductPlan.in[]Description
- idstringDescription
- referencePlanstringDescription
- planBillingPeriodpayment.pricing.BillingPeriod.inDescription
- intervalpayment.pricing.BillingPeriodInterval.inDescription
- intervalsCountinteger<int32>Description
- itemToPriceIdsOverridesmap<string, string>Description
- meterNameToPriceOverridesmap<string, payment.pricing.price.PriceStateMachineNode.in>Description
- timeGroupingIntervalcommon.aggregation.AggregationInterval.inDescription
- updateTimeInSecondsinteger<int64>Description
- customersBaseQuerypayment.analysis.modeling.by_rule.CustomersSampleSpaceKey.inDescription
- filtersmap<string, string[]>Description
- takepayment.common.Take.inDescription
- limitinteger<int32>Description
- isAscendingbooleanDescription
- customerSourcepayment.analysis.modeling.by_rule.CustomersSourceType.inDescription
- usageSourcepayment.analysis.modeling.by_rule.UsageSourceType.inDescription
Responses
200
- payment.analysis.modeling.revenue.AnalyzedPlansRevenues.outDescription
- analyzedPlanRevenueListpayment.analysis.modeling.revenue.AnalyzedPlanRevenue.out[]Description
- analysisPlanIdstringDescription
- revenuenumberDescription
- revenuePercentageDiffFromPivotPlannumberDescription
- customerGroupRevenueMapmap<string, payment.analysis.modeling.revenue.CustomerGroupRevenue.out>Description
- revenueValuespayment.analysis.modeling.revenue.RevenueValue.out[]Description
- startTimeInSecondsinteger<int64>Description
- revenuenumberDescription
- pivotPlanRevenuenumberDescription
- revenuePercentageDiffFromPivotPlannumberDescription
400
401
403
404
500
curl
curl --request POST \
--url https://app.amberflo.io/payments/analysis/by-rule-revenue-calculator \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"type": "by-rule"
}'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var raw = JSON.stringify({
"type": "by-rule"
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://app.amberflo.io/payments/analysis/by-rule-revenue-calculator", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));ruby
require "uri"
require "json"
require "net/http"
url = URI("https://app.amberflo.io/payments/analysis/by-rule-revenue-calculator")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
request.body = JSON.dump({
"type": "by-rule"
})
response = https.request(request)
puts response.read_body
python
import requests
import json
url = "https://app.amberflo.io/payments/analysis/by-rule-revenue-calculator"
payload = json.dumps({
"type": "by-rule"
})
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
200
// Returns calculated revenue analysis results with plan-level revenue projections and breakdowns
{
"analyzedPlanRevenueList": [
{
"analysisPlanId": "",
"revenue": 0,
"revenuePercentageDiffFromPivotPlan": 0,
"customerGroupRevenueMap": "",
"revenueValues": [
{
"startTimeInSeconds": "",
"revenue": 0,
"pivotPlanRevenue": 0,
"revenuePercentageDiffFromPivotPlan": 0
}
]
}
]
}400
// Invalid analysis parameters or unsupported pricing rule configurations
401
// Authentication required or invalid API key provided
403
// Insufficient permissions to perform revenue analysis
404
// Referenced pricing plans or customer data not found
500
// Internal server error occurred during revenue calculation