DEV Community

Payload
Payload

Posted on

Two signatures, one purchase

A buyer pays for an API call. The request times out, the client retries, and now two signed payment authorizations exist for a single purchase. Neither is a duplicate anyone planned. Both look valid.

This case came up in x402-foundation/x402 issue #4198, and it is the case prevention handles worst. Spending limits, idempotency keys, and client side holds all assume one process can see the other's intent. When two independent flows each sign in good faith, no shared hold ever engages, and the buyer is left holding both authorizations. Telling that buyer to be more careful next time does not settle the purchase in front of them.

Why it matters: an x402 payment is an authorization to move money. Two live authorizations for one purchase means the seller may settle twice, or the buyer may settle the wrong one, or both may sit open while support argues about which is real. The failure is quiet. Nothing errors. The money question only appears later, when someone reconciles.

What we did: callx402 is our diagnostics tool for x402 payment failures. Its duplicate_payment_risk action takes the settlement evidence for a purchase and resolves it into one of five states, locally, before anyone signs or settles anything else. Both settlements confirmed returns CONFLICT, a possible double settlement that an operator has to decide. One confirmed means the purchase is paid. Pending only means wait. No settlement attempt means settle only against an existing authorization. No usable evidence returns UNKNOWN and fails closed.

We tested the action on constructed fixtures matching the capture in the issue. No network, no live payment. The point of the exercise was narrow: given the evidence a buyer actually has, what is the safest next step, and can a tool state it plainly?

The practical lesson: prevention and diagnosis are different jobs. Prevention reduces how often two authorizations exist. Diagnosis decides what to do on the day they do. If your client can produce two signed authorizations, it also needs a rule for resolving their settlement state from evidence, and that rule should fail closed when the evidence runs out.

Relevant software: callx402, https://payloadhq.dev/callx402.html
Source discussion: https://github.com/x402-foundation/x402/issues/4198

One boundary worth stating: RevRule, our payout verification tool, is not part of this. It verifies what was owed against what was paid, which is a different step from diagnosing a payment failure.

Top comments (0)