Skip to content

feat: redeliver paid responses on retry and send merchant idempotency keys - #34

Merged
SergeevDmitry merged 21 commits into
masterfrom
feature/safe-retries
Nov 7, 2026
Merged

SergeevDmitry merged 21 commits into
masterfrom
feature/safe-retries

Conversation

@Revinand

@Revinand Revinand commented Nov 7, 2026

Copy link
Copy Markdown
Member

Adds 2.7.0 safe retries. Both features are experimental, off by default and set per resource under idempotency.

What changed

  • redelivery: a buyer who lost a paid response retries with the same input and the same retry key (the x402 payment-identifier id or the MPP Idempotency-Key header), and gets the stored response without a second charge.
    • An exact resend of the purchase's proof skips verification until retentionHours ends (1 to 8760, default 24). A fresh proof must verify as the same payer, and it is never settled.
    • Before verification, only the proof that owns a key gets an answer.
    • Key conflicts, in-flight keys and possibly-charged keys get 409 with no new payment challenge. MPP answers a conflict with 422.
  • merchantKey: paid backend calls carry a derived Idempotency-Key, which stays the same when a retry is re signed.
  • Mapped on HTTP, MCP and A2A. At startup, payment keys left in flight become unresolved, and doctor reports them.
  • The receipt database stays at schema v5, and every contract addition is optional.

Why

A response lost after settlement, for example to a dropped connection, left the buyer paying twice.

@SergeevDmitry
SergeevDmitry merged commit 9673b63 into master Nov 7, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants