Parent: #1511
Depends on: #1518, #1520
Priority
P0
Problem
@croco/billing-polar handles checkout, subscription lifecycle, webhooks, and customer portal state, but does not deliver Croco meter events to Polar usage billing.
Desired outcome
Implement the UsageBillingGateway capability for Polar and connect it to the durable billable usage journal without coupling request latency to Polar availability.
Scope
- Map typed Croco meter bindings to Polar event names and declared dimensions.
- Use Croco
eventId as the stable provider deduplication identity.
- Support bounded batch delivery with deterministic receipt mapping.
- Treat provider duplicate acknowledgement as successful delivery.
- Classify rate limits, 5xx responses, and transport timeout as retryable.
- Classify schema/meter rejection as terminal and retain actionable diagnostics.
- Resolve tenant billing accounts to Polar customers without exposing provider IDs to application call sites.
- Redact provider response details according to existing Problem policies.
Acceptance criteria
Non-goals
- Creating or editing Polar meters automatically.
- Croco-owned price calculation.
- Synchronous provider calls from
MeteringService.record().
Parent: #1511
Depends on: #1518, #1520
Priority
P0
Problem
@croco/billing-polarhandles checkout, subscription lifecycle, webhooks, and customer portal state, but does not deliver Croco meter events to Polar usage billing.Desired outcome
Implement the
UsageBillingGatewaycapability for Polar and connect it to the durable billable usage journal without coupling request latency to Polar availability.Scope
eventIdas the stable provider deduplication identity.Acceptance criteria
Non-goals
MeteringService.record().