DEV Community

Justin Chau
Justin Chau

Posted on Edited on Fully Autonomous

MPP: Turning 402 Into Machine-Native Billing

When you run into a snag online, you can pause, troubleshoot, and adjust on the fly. AI agents don’t work like that. They execute tasks step-by-step using API calls and tokens—and when an agent gets stuck in a repetitive loop or hits a dead end, those micro-tasks quickly pile up into wasted money and bloated bills. Paying per individual request only makes that friction worse, forcing an agent to repeatedly negotiate, pay, and verify every tiny action from scratch.

That is the exact problem the Machine Payments Protocol (MPP) solves. Co-authored by Stripe and Tempo, MPP is an open machine-to-machine payment standard that builds billing directly into the web's normal HTTP request-and-response cycle. When an agent hits a paid service, MPP lets it read the price tag, authorize payment, retry with proof, and get a receipt—all automatically. Better yet, MPP introduces stateful Sessions, letting an agent bundle ongoing, metered, or streaming tasks into a single open "tab" instead of paying the overhead on every single step.

Why Machine Payments Need a Different Shape Than Checkout

Traditional checkout assumes a human session—a cart, a billing form, a redirect or widget, and manual review when something stalls. Machine workloads look much more like continuous execution:

  • Pay-per-request and streaming patterns: An agent may make dozens of tool or API calls during a single task, or stream and meter usage across a session rather than buying one basket item at a time.
  • HTTP 402 challenge-and-retry: Instead of custom login walls or pre-funded enterprise accounts for every endpoint, MPP uses HTTP 402 Payment Required challenges (WWW-Authenticate payment terms from the server), retries carrying payment credentials (Authorization payment proof), and settlement receipts (Payment-Receipt returned with the response).
  • Multi-rail flexibility: MPP separates protocol mechanics from payment rails—supporting both traditional card credentials/tokens and stablecoin or on-chain rails such as Tempo.
  • Intents (charge, session, subscription): MPP defines one-time charges, recurring subscriptions, and ongoing metered sessions. Sessions are especially important for agents: a client establishes a payment relationship once via deposit or authorization and meters usage across many calls without repeating a full 402 handshake each time. Stripe's docs note sessions can meter usage in increments as small as 0.000001 USDC with periodic settlement in whole-cent increments—avoiding per-request on-chain overhead when streaming tokens or making thousands of tiny calls.

Where Real-World Execution Can Still Break

A clean protocol handshake doesn't automatically make a backend resilient. When agents retry requests automatically or run high-frequency loops, a few operational failure modes show up fast:

  • Replay and retry edge cases: Timeouts, automatic agent retries, and aggressive caching can cause trouble if challenges or receipts aren't handled carefully. Single-use proof semantics and idempotency are essential so retries don't trigger double charges or inconsistent state.
  • Challenge verification and bound spend: Agents and clients need strict guardrails before paying (checking expected amount, currency/asset, recipient, and validity windows), while servers need clean validation and clear status distinctions between payment challenges and unrelated auth errors.
  • Ledger and status sync: Whether settling via card rails or stablecoin deposit/offramp flows, your application state, receipts, and reconciliation records have to stay aligned without silent mismatches or stuck pending states.

Practical Validation Steps for Builders & Merchants

Before exposing paid endpoints or agentic flows to production traffic, test the boring edge cases alongside the happy path:

  • Challenge-to-retry loop: Verify that unpaid requests return a clean 402 challenge (no-store), retries with valid credentials return the resource plus a receipt, and invalid or tampered proofs fail safely.
  • Replay and duplicate-request protection: Re-send the same payment proof or duplicate action payload to confirm single-use enforcement and idempotent behavior.
  • Amount, currency, and expiry checks: Test mismatched currencies, invalid amounts, and expired windows so errors stay explicit and predictable. Keep Stripe's MPP minimums in mind: $0.50 USD for card payments via Shared Payment Tokens, and $0.01 USDC for stablecoin payments (available via charge on Tempo/Base, or via session for metered use). Sessions can meter sub-cent increments during usage, but the minimum settlement amount is $0.01 USDC.
  • End-to-end state and receipt checks: Confirm that settled transactions, receipts, and downstream statuses match across your server logs and payment provider records.

A Note on Standardization Status

MPP's core specification was submitted to the IETF as an individual Internet-Draft ("The Payment HTTP Authentication Scheme", version 01 as of September 2026) rather than a formal IETF working-group standard. While Stripe and Tempo publish it openly and provide open-source tooling, it isn't a frozen standards-track spec yet—so teams relying on it long-term should track draft updates rather than assuming stability.

Closing Takeaway

MPP gives HTTP endpoints a standardized way to negotiate payment and prove settlement without human checkout friction. For builders running APIs or agent workflows, the real payoff comes from pairing that challenge-retry flow with tight spend guardrails, replay/idempotency discipline, and reliable state tracking. And when workloads shift from one-off calls to continuous streaming or metered compute, the session intent is what sets MPP apart from simple per-request billing.

To learn more about HarnessBuy, visit https://www.harnessbuy.com/
For official documentation of MPP, visit https://mpp.dev/

Top comments (0)