Preflight Checklist
OpenMeter Version
latest
Expected Behavior
Use case
I am integrating OpenMeter for usage-based billing with prepaid customer credits.
My target flow is:
- Create a customer
- Create metered features (token/call based usage)
- Create a plan with usage-based (non-flat) prices
- Subscribe the customer to that plan
- Ingest usage events
- Grant customer-level billing credits
- Let billing/subscription sync generate billable artifacts
- Consume credits as usage is billed
Goal: use customer credit balance as the source of truth for ongoing spend control and potential usage blocking logic.
Problem
In this flow, usage is ingested and meter queries show usage, but billing artifacts for that customer are not materialized:
- customer charges endpoint stays empty
- invoice creation fails with
invoice_create_no_lines
- customer credits remain unchanged (
funded only, no consumed)
This prevents validating the expected “usage -> charge/invoice -> credit deduction” lifecycle for non-flat pricing.
Environment
- OpenMeter quickstart Docker setup
- API base:
http://localhost:48888
- Credits config in running container:
credits.enabled: true
enable_credit_then_invoice: true
Actual Behavior
GET /customers/{id}/charges returns empty (total: 0)
POST /api/v1/billing/invoices/invoice returns 400:
- Credits are not consumed:
- balance unchanged
- transactions contain
funded, but no consumed
Steps To Reproduce
- Create customer (with usage attribution subject key)
- Create meter + feature
- Create plan with non-flat usage-based rate card
- Publish plan
- Create subscription for customer + plan
- Ingest event(s) for that customer subject
- Create customer-level credit grant (
/api/v3/openmeter/customers/{id}/credits/grants)
- Trigger subscription sync / collect jobs
- Check:
GET /api/v3/openmeter/customers/{id}/charges
POST /api/v1/billing/invoices/invoice with customerId
GET /api/v3/openmeter/customers/{id}/credits/balance
GET /api/v3/openmeter/customers/{id}/credits/transactions
Additional Information
Expected behavior
For a customer with active subscription, non-flat usage-based pricing, ingested usage, and available credits:
- billable artifacts should be generated from usage (charges and/or invoice lines)
- invoice should be creatable/advancable with non-zero billable lines
- customer-level credits should be consumed according to settlement mode/config
Code-level hint / suspicion
This validation indicates non-flat invoice items require featureKey:
openmeter/billing/gatheringinvoice.go
if i.Price.Type() != productcatalog.FlatPriceType && i.FeatureKey == "" {
errs = append(errs, errors.New("feature key is required for non-flat prices"))
}
Preflight Checklist
OpenMeter Version
latest
Expected Behavior
Use case
I am integrating OpenMeter for usage-based billing with prepaid customer credits.
My target flow is:
Goal: use customer credit balance as the source of truth for ongoing spend control and potential usage blocking logic.
Problem
In this flow, usage is ingested and meter queries show usage, but billing artifacts for that customer are not materialized:
invoice_create_no_linesfundedonly, noconsumed)This prevents validating the expected “usage -> charge/invoice -> credit deduction” lifecycle for non-flat pricing.
Environment
http://localhost:48888credits.enabled: trueenable_credit_then_invoice: trueActual Behavior
GET /customers/{id}/chargesreturns empty (total: 0)POST /api/v1/billing/invoices/invoicereturns 400:invoice_create_no_linesfunded, but noconsumedSteps To Reproduce
/api/v3/openmeter/customers/{id}/credits/grants)GET /api/v3/openmeter/customers/{id}/chargesPOST /api/v1/billing/invoices/invoicewithcustomerIdGET /api/v3/openmeter/customers/{id}/credits/balanceGET /api/v3/openmeter/customers/{id}/credits/transactionsAdditional Information
Expected behavior
For a customer with active subscription, non-flat usage-based pricing, ingested usage, and available credits:
Code-level hint / suspicion
This validation indicates non-flat invoice items require
featureKey:openmeter/billing/gatheringinvoice.go