<?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: Thái Sơn</title>
    <description>The latest articles on DEV Community by Thái Sơn (@graviton711).</description>
    <link>https://dev.to/graviton711</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%2F4262114%2F428a62b7-553f-45aa-845a-109d97e6821a.png</url>
      <title>DEV Community: Thái Sơn</title>
      <link>https://dev.to/graviton711</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/graviton711"/>
    <language>en</language>
    <item>
      <title>Reading an x402 402 Payment-Required Challenge Without Paying</title>
      <dc:creator>Thái Sơn</dc:creator>
      <pubDate>Tue, 24 Nov 2026 08:03:32 +0000</pubDate>
      <link>https://dev.to/graviton711/reading-an-x402-402-payment-required-challenge-without-paying-2bkh</link>
      <guid>https://dev.to/graviton711/reading-an-x402-402-payment-required-challenge-without-paying-2bkh</guid>
      <description>&lt;p&gt;I called an x402-protected market-data endpoint to see exactly what a client receives before any payment happens.&lt;/p&gt;

&lt;p&gt;Request:&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;GET&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;//x402atlas.xyz/api/gas/base&lt;/span&gt;
&lt;span class="nc"&gt;Accept&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;Response: &lt;strong&gt;HTTP 402 Payment Required&lt;/strong&gt;, body &lt;code&gt;{"error":"Payment required"}&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The useful data is in the &lt;code&gt;payment-required&lt;/code&gt; response header, a base64-encoded JSON object:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;x402Version: 2&lt;/code&gt;, &lt;code&gt;error: Payment required&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;resource.url: https://x402atlas.xyz/api/gas/base&lt;/code&gt;, &lt;code&gt;mimeType: application/json&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;serviceName: AtlasData&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;7 accepted payment requirements, all &lt;code&gt;scheme: exact&lt;/code&gt;, &lt;code&gt;amount: 1000&lt;/code&gt; (micro USDC = $0.001), &lt;code&gt;maxTimeoutSeconds: 3600&lt;/code&gt;, &lt;code&gt;payTo: 0x299cb831e8580f559e58064d4F145389dB418eCE&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Networks: eip155:196, 1329, 42161, 43114, 137, 8453 (USDC on each), plus solana:5eykt4... (USDT)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Why this matters for agents: you can inspect price, accepted networks and payment destination from the 402 challenge alone, before deciding whether to pay. A plain browser request returns a rendered HTML payment page instead, which hides the machine-readable payload — always send &lt;code&gt;Accept: application/json&lt;/code&gt; when probing an x402 endpoint programmatically.&lt;/p&gt;

&lt;p&gt;I also confirmed &lt;code&gt;/api/feargreed&lt;/code&gt; and &lt;code&gt;/api/ticker/BTC&lt;/code&gt; return the same 402 structure.&lt;/p&gt;

</description>
      <category>lightning</category>
    </item>
  </channel>
</rss>
