Consumption and metering
This page explains what a consumption overlay is, what you configure in the SDKs to support one, and how the usage you record turns into money.
What a consumption overlay is
Section titled “What a consumption overlay is”Every offering has one of two base pricing models: a subscription that recurs on a schedule, or a One-time purchase. Either can add a consumption overlay on top.
The overlay is two things together: features that are rate limited, and usage that is billed per period. There is no metered-only model on Monaiq, so consumption is always an addition to a base price rather than the whole of it. Sellers define the rate-limited features on the offering itself; Products and offerings covers that side.
Point the client at the consumption service
Section titled “Point the client at the consumption service”Metered work runs against the consumption API rather than the licensing API, so the client needs both addresses.
In .NET, set both URIs on the options:
builder.Services.Configure<LicensingServiceOptions>(options =>{ options.LicenseServiceUri = "https://api.monaiq.com/licensing"; options.ConsumptionServiceUri = "https://api.monaiq.com/consumption"; options.EncodedCredential = builder.Configuration["Licensing:EncodedCredential"];});builder.Services.AddSidubLicensing();In Node, add consumptionServiceUri to the constructor:
const client = new LicensingClient({ licenseServiceUri: 'https://api.monaiq.com/licensing', consumptionServiceUri: 'https://api.monaiq.com/consumption', encodedCredential: process.env.MONAIQ_CREDENTIAL // SIDUB_LIC_...});The Node client also takes billableResourceId and billablePlanId, which name what the usage is
billed against. Node client reference lists both.
Enforcing a rate limit
Section titled “Enforcing a rate limit”In Node, RateLimitAssertion is the assertion for a rate-limited feature; the other assertions are
in Node client reference.
In .NET, the members involved are PerformOperation<TFeature, TState> for work that runs against a
feature and AssertLicense for enforcing a condition, both on ILicensingService. See
.NET client reference.
How usage becomes an invoice line
Section titled “How usage becomes an invoice line”Usage accrues through the billing period and is billed for that period, on top of the base price the offering already charges. The invoice it lands on moves through Draft, Finalized and Paid as the period closes and payment is taken.
Both sides can see it:
- Sellers see usage broken down by feature, by customer and by offering in analytics, and the invoice itself in invoices. Analytics and Get paid cover both.
- Buyers see the charge in their invoice history on Billing. See Billing and payment methods.
- Endpoints for the addresses used above.
- Credentials and keys for the credential both clients need.