Design Threshold Billing That Charges Advertisers as Spend Accrues

Last updated: November 29, 2026

Quick Overview

Design the billing system that charges self-serve Meta advertisers' cards each time their accrued ad spend reaches a billing threshold, plus monthly, and handles failed charges without letting debt grow unbounded.

Meta
System Design
Software Engineer
Meta
November 29, 2026
Software Engineer
Onsite
System Design
Medium

0

0

0 solved


Design the billing system that charges self-serve Meta advertisers' cards each time their accrued ad spend reaches a billing threshold, plus monthly, and handles failed charges without letting debt grow unbounded.

Millions of small businesses advertise on Meta with a card on file, and spend accrues continuously from the auction. Interviewers check the handoff from spend aggregation to invoicing, threshold logic under concurrency, payment failure policy, and how ads delivery is paused.

What the Interviewer Expects
  • Accrue spend from billable events into an account balance
  • Trigger charges at thresholds without double charging
  • Grow thresholds for trusted accounts
  • Handle failed payments and pause delivery
  • Produce invoices and receipts with taxes
Key Topics to Cover
Billing thresholds
Accrual
Idempotent charges
Credit risk
Invoicing
How to Approach This
  1. Start by clarifying functional and non-functional requirements with the interviewer.
  2. Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
  3. Draw a high-level architecture first, then deep dive into 1-2 critical components.
  4. Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
  5. Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
  • Two charges trigger at the same time for one account: how do you prevent both?
  • How far can spend overshoot the threshold between checks?
  • What happens to running ads when a card is declined?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements

Functional: each ad account has a threshold (for example 25risingto25 rising to 750); when unbilled spend reaches it, charge the payment method; also charge on the monthly bill date; on failure retry and ...

High-Level Design
  • Spend aggregation (from the billing-grade impression and click pipeline) emits per-account spend increments every minute.
  • Billing balance service: per account unbilled_spend, threshold...

Submit Your Answer
Markdown supported