This guide provides a complete reference for managing Pricing Models in your billing system. A Pricing Model defines how a subscription is charged using one or more meters and various pricing strategies.
๐งพ Pricing Model Schema
Fields
Field |
Type |
Required |
Description |
name |
string |
โ
|
Human-readable name of the pricing model |
id |
string |
โ
|
Unique ID for the pricing model |
type |
`'recurring' |
'one-time'` |
โ
|
charge_type |
`'standard' |
'tiered' |
'volume' |
baseAmount |
number |
โ๏ธ |
Optional base charge in the billing cycle |
components |
CompositeComponent[] |
โ
|
List of meter-based charge components |
combination_operator |
`'AND' |
'OR'` |
โ
if charge_type=composite |
or_strategy |
`'higher' |
'lower'` |
โ
if operator is OR |
currency |
string |
โ
|
Billing currency (e.g., USD , PKR ) |
additional |
[{ key, value, type, inclusive }] |
โ๏ธ |
Extra charges (tax, markup etc.) |
๐งฉ Composite Component Schema
A pricing model may include multiple components. Each maps to a billing meter:
Field |
Type |
Required |
Description |
meter_id |
string |
โ
|
Reference to billingMeters.id |
pricing_type |
string |
โ
|
One of: 'standard' , 'tiered' , 'volume' , 'percentage' |
standard |
{ amount: number } |
Conditional |
Required if pricing_type is standard |
tiered |
[{ lowerLimit, upperLimit, pricePerUnit, flatFee }] |
Conditional |
Used when tiered pricing |
volume |
Same as tiered |
Conditional |
For volume-based pricing |
percentage |
{ percentage: number, flatFee?: number } |
Conditional |
For revenue share models |
fixedPrice |
number |
Optional |
Flat charge per meter (independent of usage) |
โ Additional Charges Schema
Field |
Type |
Required |
Description |
key |
string |
โ
|
Descriptive name, e.g., tax , service_fee |
value |
number |
โ
|
Amount or percentage |
type |
`'fixed' |
'percentage'` |
โ
|
inclusive |
boolean |
โ
|
Whether the charge is inclusive or added to total |
๐ Create Pricing Model
POST /public/v1/pricing/model
Body Example:
{
"name": "Pro Plan",
"id": "pro-plan-2025",
"type": "recurring",
"charge_type": "composite",
"combination_operator": "OR",
"or_strategy": "higher",
"currency": "USD",
"components": [
{
"meter_id": "api-requests",
"pricing_type": "tiered",
"tiered": [
{ "lowerLimit": 1, "upperLimit": 1000, "pricePerUnit": 0.01 },
{ "lowerLimit": 1001, "upperLimit": 10000, "pricePerUnit": 0.008 }
]
},
{
"meter_id": "data-usage",
"pricing_type": "percentage",
"percentage": { "percentage": 2.5, "flatFee": 1 }
}
],
"additional": [
{ "key": "tax", "value": 10, "type": "percentage", "inclusive": false }
]
}
โ๏ธ Update Pricing Model
PATCH /public/v1/pricing/model/:pm_id