<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Shunhe Wang</title>
    <description>The latest articles on DEV Community by Shunhe Wang (@shunhe_wang_55c8d905fdbfc).</description>
    <link>https://dev.to/shunhe_wang_55c8d905fdbfc</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4273192%2F152f17c5-bdf7-46fa-a355-e1121ea0a603.png</url>
      <title>DEV Community: Shunhe Wang</title>
      <link>https://dev.to/shunhe_wang_55c8d905fdbfc</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shunhe_wang_55c8d905fdbfc"/>
    <language>en</language>
    <item>
      <title>HTTP 402 Solved Agent Payments. It Didn’t Solve What Happens When the API Ghosts You.</title>
      <dc:creator>Shunhe Wang</dc:creator>
      <pubDate>Mon, 30 Nov 2026 02:05:25 +0000</pubDate>
      <link>https://dev.to/shunhe_wang_55c8d905fdbfc/http-402-solved-agent-payments-it-didnt-solve-what-happens-when-the-api-ghosts-you-5fab</link>
      <guid>https://dev.to/shunhe_wang_55c8d905fdbfc/http-402-solved-agent-payments-it-didnt-solve-what-happens-when-the-api-ghosts-you-5fab</guid>
      <description>&lt;p&gt;The x402 protocol made machine-to-machine payments simple: a client hits an endpoint, receives &lt;code&gt;402 Payment Required&lt;/code&gt;, signs a USDC authorization, retries with a payment header, and gets the response.&lt;/p&gt;

&lt;p&gt;That solves the happy path. It does not solve the failure path.&lt;/p&gt;

&lt;p&gt;What happens when an autonomous agent pays $15 for a dataset, research job, or fulfillment call and receives malformed output, partial delivery, or nothing at all?&lt;/p&gt;

&lt;p&gt;With card networks, there is a chargeback pipeline (slow, expensive, and built around human cardholders). With stablecoin push payments over HTTP 402, settlement is final by default. You cannot just “call your bank.” And for a $15 or $200 commercial disagreement, traditional arbitration or small-claims litigation costs more than the amount in dispute.&lt;/p&gt;

&lt;p&gt;At &lt;a href="https://peoplescourt.ai" rel="noopener noreferrer"&gt;People’s Court&lt;/a&gt;, we built an open-source dispute extension and an x402-native readiness endpoint to bridge that gap without changing how x402 settles payments. Here is how the architecture works and the design constraints we ran into.&lt;/p&gt;

&lt;h2&gt;
  
  
  Constraint 1: Never hijack the payment rail
&lt;/h2&gt;

&lt;p&gt;Early on, it is tempting to wrap every agent payment in a custom custodial escrow contract. In practice, most x402 endpoints want ordinary, instant settlement, or they want to choose their own escrow layer (such as &lt;code&gt;x402r&lt;/code&gt; refund/escrow contracts) independently of who adjudicates a dispute.&lt;/p&gt;

&lt;p&gt;So we split the problem into two layers:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Ordinary x402 (no custody change):&lt;/strong&gt; Attach a verifiable dispute-terms commitment and payer acceptance alongside the payment, and generate a canonical, size-bounded evidence packet if the transaction goes wrong.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Escrowed rails (&lt;code&gt;x402r&lt;/code&gt;):&lt;/strong&gt; When funds &lt;em&gt;are&lt;/em&gt; held in an escrow window, bind the case record to the payment hash so a signed, verified Award can direct &lt;code&gt;capture&lt;/code&gt;, &lt;code&gt;void&lt;/code&gt;, or partial release within the escrow window.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The dispute forum never holds user funds in either design.&lt;/p&gt;

&lt;h2&gt;
  
  
  Constraint 2: Separate settlement proof from private payment secrets
&lt;/h2&gt;

&lt;p&gt;When an agentic transaction fails, both sides need an auditable record of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;what resource and deliverable were promised,&lt;/li&gt;
&lt;li&gt;which dispute rules and forum terms both sides agreed to,&lt;/li&gt;
&lt;li&gt;the settlement transaction and amount, and&lt;/li&gt;
&lt;li&gt;what was actually delivered (or not delivered).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One easy security mistake is dumping raw signed authorization headers into a dispute file. In our open-source TypeScript SDK (&lt;code&gt;shunhe-wang/peoples-court-x402-disputes&lt;/code&gt;), the derivative evidence packet explicitly excludes private signed payment payloads while preserving the cryptographic bindings (resource URL, amount, transaction reference, terms digest, and recovered payer acceptance signature).&lt;/p&gt;

&lt;p&gt;In our Base Sepolia fixture run (transaction &lt;code&gt;0xd1aa7830aa1c87dccf04e85218a2feebc2b5e4b081eeafcf90ad9aa5b41a8819&lt;/code&gt;, 0.01 test USDC), tampering with the resource, transaction hash, or amount causes packet verification to fail deterministically before any adjudicator sees it. You can reproduce the packet and tamper checks locally from the public repo (&lt;code&gt;npm --prefix packages/x402-disputes run check&lt;/code&gt;).&lt;/p&gt;

&lt;h2&gt;
  
  
  Constraint 3: Agents need a deterministic pre-flight check before filing
&lt;/h2&gt;

&lt;p&gt;Filing a binding arbitration case should never be a casual tool call an LLM fires off mid-loop. Before a workflow escalates a failed transaction, an agent or marketplace backend needs to know:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Does this claim fit an eligible lane?&lt;/li&gt;
&lt;li&gt;What is the exact published filing fee?&lt;/li&gt;
&lt;li&gt;Are mutual consent and binding authority actually satisfied?&lt;/li&gt;
&lt;li&gt;If funds are in an &lt;code&gt;x402r&lt;/code&gt; escrow, is the escrow window about to expire before the written briefing schedule can finish?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To answer those questions programmatically, we exposed a fixed-price x402 v2 endpoint:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="no"&gt;POST&lt;/span&gt; &lt;span class="n"&gt;https&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="c1"&gt;//peoplescourt.ai/api/x402/dispute-readiness&lt;/span&gt;
&lt;span class="nc"&gt;Content&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;application&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;json&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;An unpaid call returns an x402 v2 &lt;code&gt;402 Payment Required&lt;/code&gt; challenge priced at &lt;strong&gt;$0.01 USDC&lt;/strong&gt; (&lt;code&gt;10000&lt;/code&gt; atomic units on 6-decimal USDC) with Bazaar discovery metadata. The machine-readable OpenAPI spec is published at &lt;code&gt;https://peoplescourt.ai/openapi.json&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;A paid call returns a deterministic JSON report covering:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;supportedLane&lt;/code&gt; and &lt;code&gt;readyToFile&lt;/code&gt;,&lt;/li&gt;
&lt;li&gt;likely tribunal composition (single AI arbiter for eligible small money claims under $100; three-member AI panel otherwise; or AI-assisted human if all parties choose it),&lt;/li&gt;
&lt;li&gt;exact published filing-fee quote (AI-only is 5.67% of the amount in dispute, $25 floor, separate from disputed funds),&lt;/li&gt;
&lt;li&gt;missing consent or evidence requirements,&lt;/li&gt;
&lt;li&gt;corpus compatibility, and&lt;/li&gt;
&lt;li&gt;escrow-window timing warnings.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Crucially, this endpoint is strictly informational: it &lt;strong&gt;never files a case, assesses merits, gives legal advice, or moves disputed funds&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Constraint 4: Signed Awards and verifiable execution
&lt;/h2&gt;

&lt;p&gt;When a dispute &lt;em&gt;does&lt;/em&gt; proceed on an escrowed rail like &lt;code&gt;x402r&lt;/code&gt;, the entire lifecycle needs to be verifiable without trusting screenshots:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Both sides consent to a pinned Rules snapshot (version + SHA-256 hash).&lt;/li&gt;
&lt;li&gt;Submissions and exhibits freeze into a closed written Record.&lt;/li&gt;
&lt;li&gt;The assigned Tribunal issues a reasoned written Award whose hash is ECDSA-signed (EIP-191) at issuance.&lt;/li&gt;
&lt;li&gt;On Base Sepolia controlled exercises (for example, our &lt;code&gt;x402r&lt;/code&gt; verification run in &lt;code&gt;shunhe-wang/arbiter-examples&lt;/code&gt;, settlement receipt &lt;code&gt;0x22f8738b69c482523e476257c7542f626d94ee2bfb8734d1b7341c3d647c0a76&lt;/code&gt;), we verified all four settlement operations (&lt;code&gt;capture&lt;/code&gt;, &lt;code&gt;void&lt;/code&gt;, &lt;code&gt;refuse&lt;/code&gt;, and partial capture/split) end-to-end on testnet USDC. &lt;em&gt;(These are controlled synthetic/testnet verification runs, not organic mainnet dispute volume.)&lt;/em&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  What is still hard
&lt;/h2&gt;

&lt;p&gt;Building the plumbing made three unsolved ecosystem problems obvious:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Standardizing failure receipts:&lt;/strong&gt; Payment protocols agree on how to prove money moved, not how to prove an API or merchant delivered what was promised. (This is why we have been participating in open efforts like the A-Comm Evidence Protocol and x402 dispute discussions.)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Escrow windows vs. due process:&lt;/strong&gt; Giving a counterparty fair notice and time to respond collides with short on-chain settlement timeouts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Prompt injection inside evidence:&lt;/strong&gt; Once an AI system reads untrusted counterparty submissions, adversarial text inside an invoice or webhook payload is an evidence-integrity problem, not just a chat safety problem.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you are building x402 clients, facilitators, or agent marketplaces and thinking through post-payment failure paths, the docs and open-source repo are public:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Docs &amp;amp; guide: &lt;a href="https://peoplescourt.ai/x402" rel="noopener noreferrer"&gt;https://peoplescourt.ai/x402&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;OpenAPI spec: &lt;a href="https://peoplescourt.ai/openapi.json" rel="noopener noreferrer"&gt;https://peoplescourt.ai/openapi.json&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Dispute-packet SDK: &lt;a href="https://github.com/shunhe-wang/peoples-court-x402-disputes" rel="noopener noreferrer"&gt;https://github.com/shunhe-wang/peoples-court-x402-disputes&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Happy to compare notes in the comments on how you are handling refunds, receipts, or contested deliveries in agentic workflows.&lt;/p&gt;

</description>
      <category>x402</category>
      <category>ai</category>
      <category>payments</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
