Priority
P0 umbrella — establish the trusted monetization path before adding a Croco-owned rating engine, credit ledger, or additional billing providers.
Context
This plan is based on trunk at 2a6e12c5c214eaa817046ebcf6b477796131609f.
Croco already has strong local domain building blocks:
@croco/metering-core records usage, enforces quota, and supports idempotency;
@croco/billing-core owns checkout, subscription lifecycle, plan lookup, proration seams, and invoice types;
@croco/entitlements-core enforces feature and metered quota access;
@croco/billing-polar owns the current production billing provider boundary;
- the SaaS preset and admin surfaces already connect or display parts of this state.
The missing path is the boundary between locally observed usage and provider-accepted billable usage. Today a usage record can be persisted and a UsageRecordedEvent can be published, but the framework does not define a durable provider-delivery contract, provider usage capability, immutable plan-version binding, or a build-time consistency check tying meters, plan pricing, subscriptions, and entitlements together.
Goal
A Croco application should be able to:
- define a typed meter once;
- record billable usage with a stable logical event identity;
- durably deliver that usage to a billing provider without silent loss or duplicate charging;
- pin each subscription to an immutable plan version;
- ensure the same plan version owns provider product mappings and entitlement/quota rules;
- detect unsupported or incomplete monetization wiring before deployment;
- prove the full path through conformance and generated SaaS evidence.
Design principles
- Local usage, durable billable intent, and provider-accepted usage are separate states.
- Request handlers must not synchronously depend on a remote billing provider.
- Provider retries must be idempotent; duplicate acknowledgement is success, not failure.
- Provider capabilities must be explicit and inspectable, not optional methods with permissive fallbacks.
- Published plan versions are immutable and subscriptions remain pinned until explicitly migrated.
- Entitlement and provider pricing mappings must resolve from the same plan version.
- Reuse ContractGraph, Problem Registry, events/transaction boundaries, diagnostics, provider certification, and generated-app smoke rather than adding another control plane.
- Keep provider-rated billing as the first supported path. A Croco-owned rating engine is deferred until provider limitations justify a second source of truth.
Delivery order
Foundation
Product consistency
Executable evidence
Child issue links will be added after creation.
Foundation exit gate
Do not add a public internal rating engine until all of the following are true:
Explicit non-goals
- Building a general billing control plane or hosted billing service.
- Replacing Polar invoice calculation, tax, payment collection, or dunning.
- Supporting arbitrary JavaScript pricing callbacks.
- Implementing a local promotional credit ledger in this phase.
- Reopening completed admin panel or generic SaaS smoke work; this initiative should extend those existing surfaces when its read models are available.
Existing related work
This initiative must build on those outcomes rather than duplicate them.
Priority
P0 umbrella — establish the trusted monetization path before adding a Croco-owned rating engine, credit ledger, or additional billing providers.
Context
This plan is based on
trunkat2a6e12c5c214eaa817046ebcf6b477796131609f.Croco already has strong local domain building blocks:
@croco/metering-corerecords usage, enforces quota, and supports idempotency;@croco/billing-coreowns checkout, subscription lifecycle, plan lookup, proration seams, and invoice types;@croco/entitlements-coreenforces feature and metered quota access;@croco/billing-polarowns the current production billing provider boundary;The missing path is the boundary between locally observed usage and provider-accepted billable usage. Today a usage record can be persisted and a
UsageRecordedEventcan be published, but the framework does not define a durable provider-delivery contract, provider usage capability, immutable plan-version binding, or a build-time consistency check tying meters, plan pricing, subscriptions, and entitlements together.Goal
A Croco application should be able to:
Design principles
Delivery order
Foundation
Product consistency
Executable evidence
Child issue links will be added after creation.
Foundation exit gate
Do not add a public internal rating engine until all of the following are true:
Explicit non-goals
Existing related work
This initiative must build on those outcomes rather than duplicate them.