Usage Events
are the mechanism by which Merchants
report their Customers
’ consumption of Billable Metrics
to Paygentic. Sending Usage Events
is the final step in the core loop, triggering real-time billing and payment deductions from the Consumer
’s Wallet
.
Customer
interacts with your Product
in a way that consumes a Billable Metric
defined in their active Subscription
’s Plan
, you should report this consumption by sending a Usage Event
to Paygentic.
Upon receiving a valid Usage Event
, Paygentic does the following:
Customer
and their active Subscription
.Plan
and the Price
associated with the billableMetricId
(s) reported in the event.quantity
and the applicable Price
(considering the pricing model - standard, dynamic, volume, percentage).Consumer
Organization
’s Wallet
.Merchant
Organization
’s Wallet
.Usage Event
object contains several key pieces of information. Here are some of the most important ones:
Merchant
when creating the event. Paygentic uses this key to deduplicate events. If you send the same event (with the same idempotencyKey
) multiple times within a reasonable window, it will only be processed once, preventing accidental double-billing. It’s crucial to generate a unique key for each distinct usage occurrence.Customer
resource representing the relationship between the Merchant
and the Consumer
who consumed the resource.Merchant
Organization
reporting the usage.Merchant
. This should be accurate and fall within the Customer
’s current billing period for their Subscription
.Billable Metrics
consumed and their quantities in this event. See structure below.price
(in smallest currency unit) and the ID of the internal billing transaction.Merchant
for storing additional context or internal references related to the event.POST /usage
).POST /usage/batch
).https://edge-api.paygentic.com/v0/usage
or regional endpoints for 30-70% latency reduction.idempotencyKey
customerId
merchantId
(usually inferred from authentication, but required in the body per spec)timestamp
properties
(detailing the usage)properties
ArrayBillable Metric
.
Billable Metric
that was consumed.Billable Metric
’s unit that was consumed in this event (e.g., 1
for one API call, 1024
for 1024 tokens).dynamic
and percentage
pricing models.dynamic
pricing: Specifies the total price (not per unit) to charge for the consumed quantity in this specific event. This price must fall within the minPrice
and maxPrice
defined in the Price
object.percentage
pricing: Specifies the base amount (e.g., invoice total, transaction amount) on which the percentage is calculated. The actual charge will be baseAmount * percentage
, bounded by minCharge
and maxCharge
.properties
array:
timestamp
you report falls within the current billing period of the customer’s active Subscription
. Events reported outside this window may be rejected.idempotencyKey
for each distinct usage event you intend to bill for. Retrying a failed request with the same idempotencyKey
is safe.Usage Events
accurately and promptly is key to leveraging Paygentic’s real-time billing capabilities.