Metered Billing
Charge for measured usage without surprising anyone at invoice time.
What it adds
Idempotent usage recording, defined aggregation into billable quantities, correction handling, and a running estimate the customer can see.
What your agent is told to do
5
What your agent is told to do
5-
1
Record each usage event with a caller-supplied immutable ID and reject repeats. Retried requests and re-delivered queue messages will otherwise be billed twice.
-
2
Define the aggregation window, the unit, the rounding direction and the included allowance in one place, and apply them identically to the estimate and the invoice.
-
3
Show a running cost estimate in the app, labelled as an estimate, with the period it covers and the time it was last updated.
-
4
Handle usage that arrives after its window closed and usage that is later reversed. Decide whether it lands in the closed period or the current one, and be consistent.
-
5
Plan-cap enforcement, race-safe counting against a limit, and the blocked-at-limit upgrade prompt are owned by Usage Limits. Metering measures; it does not gate. Extend Usage Limits rather than adding a second enforcement path.
Edge cases it handles
6
Edge cases it handles
6- Clock skew between reporting services will place events in the wrong window. Bill by the event's own timestamp, not arrival time, and define how late an event may be.
- A reversed or refunded unit of usage needs a negative entry, not the deletion of the original event.
- Rounding per event and rounding per period give different totals. Pick one, state it, and never apply both.
- The estimate will not exactly match the final invoice once tax, discounts and provider rounding are applied. Say so next to the number rather than being caught out by it.
- Usage recorded against a subscription that changed plan mid-period must be priced against the plan in force when it occurred.
- A burst of events must not be dropped silently under load. Queue them durably; unbilled usage is lost revenue and over-billed usage is a refund.
Definition of done
8
Definition of done
8- Replaying the same usage event ID does not increase the billed quantity.
- Window, unit, rounding and allowance definitions are shared by the estimate and the invoice calculation.
- The customer can see current-period usage and an estimated cost, explicitly labelled as an estimate.
- Late and reversed usage are represented as entries, and the rule for which period they affect is documented.
- Usage is priced against the plan in force at the moment it occurred.
- Event ingestion is durable under bursts, with no silent drops.
- The feature matches the existing design system.
- No existing functionality is broken.
Related features
Usage Limits
Usage Limits
Cap what free accounts can do — visibly and fairly.
What it does
Per-plan usage limits, enforced server-side, with the user always able to see where they stand.
How it works
- 1 Define limits per plan in one place. Do not scatter magic numbers through the codebase.
- 2 Enforce on the server at the point of creation. A client-side check is decoration.
- 3 Show current usage BEFORE the user hits the wall — surprise limits feel like a bug.
Copy the prompt
No account needed
Add this feature to my app:
https://addthisfeature.com/x/usage-limits
Upgrade Modal
Upgrade Modal
Sell the upgrade at the exact moment someone wants it.
What it does
A focused upsell that appears when a free user reaches for a paid capability.
How it works
- 1 Trigger it at the point of intent — when they click the locked thing — not on a timer or on page load.
- 2 Name the specific feature they just tried to use. A generic pricing modal converts far worse.
- 3 State the price plainly and give one button to upgrade.
Copy the prompt
No account needed
Add this feature to my app:
https://addthisfeature.com/x/upgrade-modal
Billing Portal
Billing Portal
Let people manage their own subscription.
What it does
A billing area where users can see their plan, change payment method, get invoices, and cancel.
How it works
- 1 Use the payment provider's hosted billing portal if it has one. Do not rebuild card management — it's a PCI liability you don't need.
- 2 Show the current plan, renewal date, and payment method on your own account page.
- 3 Make cancelling possible without emailing support. Dark patterns here generate chargebacks.
Copy the prompt
No account needed
Add this feature to my app:
https://addthisfeature.com/x/billing-portal
How it works
-
1
Copy the link
Grab the Markdown instruction URL for this feature.
-
2
Give it to your AI
Paste it into Claude Code, Cursor, v0, Lovable — whatever you build with.
-
3
It inspects, then implements
Your agent reads your existing app first, then adds the feature to fit it.
Works with your stack
These instructions are written to adapt. They tell the agent to detect your framework, match your existing design system, and reuse what you already have — rather than assuming a particular stack.
Need it tighter than that? Customize the feature and tell it exactly what you're running.