Dev Tools · 1h ago
Billing async work exactly once: a durable outbox pattern
Synchronous billing is straightforward, but asynchronous work breaks it because the billable quantity isn't known until the job finishes. The solution is a durable outbox that writes metering tasks on completion, combined with an idempotent sink to prevent double charges. This pattern ensures exactly-once billing by pairing at-least-once delivery with at-most-once deduplication.
Meridian48 take
A practical, platform-agnostic pattern for a common billing challenge in async APIs, though the implementation details matter for real-world reliability.
billingasync-patterns