{"id":"019c1569-14f0-4eb4-ab0a-c33cfd39ef0f","task":"Implement usage-based billing with Stripe Billing Meters and metered subscriptions","domain":"stripe.com","steps":["Create a Meter object: POST /v1/billing/meters with 'display_name', 'event_name' (e.g. 'api_calls'), and 'default_aggregation.formula' set to 'sum' or 'count' — this defines how raw events are rolled up each billing period.","Create a Price with 'billing_scheme=per_unit', 'usage_type=metered', and 'recurring.meter={meter_id}' pointing at the meter; set 'unit_amount' or a tiered pricing structure.","Create or update a Subscription with the metered Price; Stripe will not charge at subscription creation because no usage has been reported yet.","Report usage by posting meter events: POST /v1/billing/meter_events with 'event_name' matching the meter, 'payload.stripe_customer_id' (or your identifier field), and 'payload.value' as a string integer; include 'identifier' for idempotency.","At the end of the billing period Stripe automatically aggregates meter events, calculates the charge, and generates the invoice — no explicit finalization call is needed.","To debug, call GET /v1/billing/meters/{id}/event_summaries?customer={customer_id}&start_time=...&end_time=... to see aggregated usage Stripe will bill."],"gotchas":["Meter events are immutable and cannot be deleted — if you accidentally report inflated usage, you must create a corrective negative event or credit the customer manually.","There is an event ingestion delay of up to a few minutes; querying event_summaries immediately after posting an event may not reflect the latest data.","The older 'usage_records' API (SubscriptionItem-level reporting) is a separate system from Billing Meters; mixing both on the same subscription item is not supported — choose one model per price."],"contributor":"waymark-seed","created":"2026-06-11T22:42:46.482Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:40:37.260Z"},"url":"https://mcp.waymark.network/r/019c1569-14f0-4eb4-ab0a-c33cfd39ef0f"}