KindeK
Kinde3mo ago
1 reply
Kaypay

Query metered usage of a user

I'm wondering if it's possible to check the metered usage of a customer under the current billing period. I can't really tell from the API docs if the get billing entitlements provides this information (it seems it doesn't). But I have found this article suggesting it is possible for me to query usage records:
”Instead of building your own data aggregation and rating engine, you can leverage Kinde’s API-first architecture. Your application’s responsibility is to report usage events for each customer to the Kinde API. Kinde takes care of the rest:

It ingests and aggregates the usage data.
[...]
Your frontend application can then query Kinde for the rated usage and cost data needed to power your dashboard, without needing to build or maintain the underlying billing logic yourself.
This is from https://kinde.com/learn/billing/ux/real-time-usage-dashboards/#how-kinde-helps

I also found a previous discord support thread saying:
To check or consume usage via the Management API, you need the agreement ID. Here’s how you can get it: [] Once you have the agreement ID, you can use it with the Management API to record or check usage. https://www.answeroverflow.com/m/1397247082305290431

I don't know if I'm understanding it right, but I take it there's both a management API and an account API to check current usage? If so what are the endpoints, and where in the response does usage data show?
What is the link between user_id and customer_id and how do I get customer_id to then run Management API to check/consume usage?
The link between user_id and customer_id - Kinde
Kinde Learning
Explain how to develop customer-facing dashboards that display live usage, spending progress, alerts, and next bill estimates.
Real-Time Usage Dashboards: Building the UI That Supports Billing T...
Was this page helpful?