Billing Integration
Integrate usage data with billing platforms
Sync your usage data with billing platforms like Stripe, Orb, or Metronome.
Overview
Limitry tracks usage data that can be exported or synced to billing platforms for usage-based pricing.
Exporting Usage Data
// Get usage data for billing period
const usage = await client.usage.summary({
customerId: 'customer_123',
startDate: '2024-01-01',
endDate: '2024-01-31',
});
// Export to CSV or sync to billing platform
exportToBilling(usage);# Get usage data for billing period
usage = await client.usage.summary(
customer_id="customer_123",
start_date="2024-01-01",
end_date="2024-01-31",
)
# Export to CSV or sync to billing platform
export_to_billing(usage)Stripe Integration
Sync usage data to Stripe for usage-based billing.
// Example: Sync usage to Stripe subscription item
const usage = await client.usage.summary({
customerId: stripeCustomerId,
startDate: billingPeriodStart,
endDate: billingPeriodEnd,
});
await stripe.subscriptionItems.createUsageRecord(
subscriptionItemId,
{
quantity: usage.totalTokens,
timestamp: 'now',
}
);Next Steps
- Usage Analytics - Get detailed usage data
- Cost Tracking Example - Track costs per customer