<?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: Umang Gupta</title>
    <description>The latest articles on DEV Community by Umang Gupta (@umangbuilds).</description>
    <link>https://dev.to/umangbuilds</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3882475%2Fa7393142-2f67-476b-aeab-fa745901bbb0.png</url>
      <title>DEV Community: Umang Gupta</title>
      <link>https://dev.to/umangbuilds</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/umangbuilds"/>
    <language>en</language>
    <item>
      <title>AI Agent Payments in India: The Complete Infrastructure Guide (2026)</title>
      <dc:creator>Umang Gupta</dc:creator>
      <pubDate>Thu, 16 Apr 2026 15:40:11 +0000</pubDate>
      <link>https://dev.to/umangbuilds/ai-agent-payments-in-india-the-complete-infrastructure-guide-2026-11am</link>
      <guid>https://dev.to/umangbuilds/ai-agent-payments-in-india-the-complete-infrastructure-guide-2026-11am</guid>
      <description>&lt;p&gt;MoltPe gives Indian developers, freelancers, and AI startups dollar-denominated agent wallets that receive and send &lt;a href="https://dev.to/glossary"&gt;USDC&lt;/a&gt; globally with zero forex fees, zero gas fees, and sub-second settlement. No foreign entity required, no credit card to start, no minimum balance. Use it alongside UPI and Razorpay for a complete domestic plus international payment stack.&lt;/p&gt;

&lt;p&gt;Table of Contents&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Why This Matters for India&lt;/li&gt;
&lt;li&gt;How MoltPe Solves It for Indian Builders&lt;/li&gt;
&lt;li&gt;MoltPe vs Razorpay International vs Stripe India vs PayPal&lt;/li&gt;
&lt;li&gt;Use Cases for Indian Builders&lt;/li&gt;
&lt;li&gt;How It Works in Three Steps&lt;/li&gt;
&lt;li&gt;Related Guides&lt;/li&gt;
&lt;li&gt;Frequently Asked Questions&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Why This Matters for India
&lt;/h2&gt;

&lt;p&gt;India has one of the world's largest and fastest growing AI developer populations. Bangalore, Hyderabad, Pune, Chennai, and Delhi NCR are producing a new generation of builders who write code in English, ship to global customers, and compete at the frontier of agent systems, retrieval-augmented generation, and automation tooling. The talent is here. The ambition is here. The payments infrastructure is not.&lt;/p&gt;

&lt;p&gt;The friction shows up the moment an Indian builder tries to collect international revenue or pay a foreign service provider. PayPal typically takes around 4 to 5 percent on cross-border receipts, plus a forex spread on the INR conversion. SWIFT wires are slow, manual, and expensive per transaction, which makes them useless for anything under a few hundred dollars. Stripe India operates under restrictions that do not apply in the US or the UK. Razorpay International runs on top of the same legacy forex rails and still imposes a conversion spread. Every one of these options was built for a world where payments were initiated by humans, cleared by correspondent banks, and measured in days.&lt;/p&gt;

&lt;p&gt;AI agent payments live in a different world. An agent making two hundred micropayments a day to different paid APIs cannot tolerate a four percent fee stack. A freelancer in Hyderabad billing a client in San Francisco does not want to wait three to five business days and lose money to forex each time. An AI SaaS founder in Bangalore charging per API call in small amounts needs settlement in seconds, not T plus two.&lt;/p&gt;

&lt;p&gt;USDC via MoltPe routes around the legacy stack entirely. USDC is a dollar-denominated stablecoin. The value never touches the SWIFT or card networks in transit. Your Indian clients, international clients, and AI agents transact directly against on-chain dollar balances, and your wallet is yours. There is no correspondent bank in the middle, no forex conversion at the platform layer, and no three-to-five-day settlement window. This is the infrastructure that the next decade of Indian AI and SaaS builders need, and it is available right now.&lt;/p&gt;

&lt;h2&gt;
  
  
  How MoltPe Solves It for Indian Builders
&lt;/h2&gt;

&lt;p&gt;MoltPe is AI-native payment infrastructure that gives AI agents isolated wallets with programmable spending policies for autonomous USDC stablecoin transactions. Every agent gets its own non-custodial wallet secured with Shamir key splitting, which means no single party, including MoltPe, ever holds a complete private key. Your funds are yours, cryptographically, from the moment the wallet is created.&lt;/p&gt;

&lt;p&gt;For Indian developers, the combination of features matters more than any single one:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Dollar-denominated balances.&lt;/strong&gt; Your agent wallet holds USDC. You hold dollars until you choose to convert. No more watching a rupee-denominated balance shrink as the dollar strengthens mid-month.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Zero forex fees at the platform level.&lt;/strong&gt; When a client in New York or London or Singapore pays your agent wallet, they transfer USDC. You receive USDC. Nothing is converted on the way in. You only touch forex when and if you decide to convert to INR later, on a venue of your choosing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Zero gas fees on supported chains.&lt;/strong&gt; MoltPe covers gas on Polygon PoS, Base, and Tempo. A two-dollar micropayment costs two dollars, not two dollars plus a thirty cent network fee.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sub-second settlement.&lt;/strong&gt; Payments clear on chain in roughly 500 milliseconds. Compare this to PayPal holds, SWIFT delays, or card network settlement windows.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Programmable spending policies.&lt;/strong&gt; Set a daily cap, a per-transaction cap, a recipient allowlist, and a cooldown period.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AI-agent-native interfaces.&lt;/strong&gt; REST API, Model Context Protocol server, and x402 support out of the box.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Free tier, no credit card, no gating.&lt;/strong&gt; An indie developer in Chennai can create an agent wallet in under five minutes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Works from any country.&lt;/strong&gt; No India-specific restriction, no US-entity requirement.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;MoltPe is the layer Indian AI builders deserve.&lt;/p&gt;

&lt;p&gt;See the full guide at &lt;a href="https://moltpe.com/india" rel="noopener noreferrer"&gt;https://moltpe.com/india&lt;/a&gt; for complete comparison tables, use cases, FAQs, and integration steps.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://moltpe.com/india" rel="noopener noreferrer"&gt;https://moltpe.com/india&lt;/a&gt;. MoltPe is AI-native payment infrastructure that gives AI agents isolated wallets with programmable spending policies for autonomous USDC transactions. &lt;a href="https://moltpe.com/dashboard" rel="noopener noreferrer"&gt;Get started free →&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>india</category>
      <category>payments</category>
      <category>web3</category>
    </item>
    <item>
      <title>How to Add Payments to Your AI Agent: Step-by-Step Tutorial</title>
      <dc:creator>Umang Gupta</dc:creator>
      <pubDate>Thu, 16 Apr 2026 12:52:31 +0000</pubDate>
      <link>https://dev.to/umangbuilds/how-to-add-payments-to-your-ai-agent-step-by-step-tutorial-54ok</link>
      <guid>https://dev.to/umangbuilds/how-to-add-payments-to-your-ai-agent-step-by-step-tutorial-54ok</guid>
      <description>&lt;p&gt;&lt;a href="https://moltpe.com" rel="noopener noreferrer"&gt;MoltPe&lt;/a&gt; enables developers to integrate autonomous USDC payments into AI agents in under five minutes. This tutorial walks you through every step — from wallet creation to your first payment.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;Before starting, you'll need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A free MoltPe account (no credit card required)&lt;/li&gt;
&lt;li&gt;An AI agent or LLM environment capable of making API calls&lt;/li&gt;
&lt;li&gt;USDC funding on Polygon PoS, Base, or Tempo (even $1 works for testing)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The platform handles wallet creation, key management, and transaction signing behind the scenes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Create an Agent Wallet
&lt;/h2&gt;

&lt;p&gt;Each agent needs an isolated, non-custodial wallet:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Sign up at &lt;a href="https://moltpe.com/dashboard" rel="noopener noreferrer"&gt;moltpe.com/dashboard&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Click "Create Wallet" and give it a descriptive name&lt;/li&gt;
&lt;li&gt;Select your preferred network (Polygon PoS, Base, or Tempo)&lt;/li&gt;
&lt;li&gt;Record your wallet address and wallet ID&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The system uses Shamir secret sharing to split private keys, ensuring no single party holds complete key access.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Fund Your Wallet and Set Policies
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Deposit USDC:&lt;/strong&gt; Send stablecoins to your wallet address. No minimum required. Gas fees are covered by MoltPe on supported chains.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Configure Spending Policies:&lt;/strong&gt; Set guardrails enforced at the infrastructure level:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;daily_limit_usdc&lt;/strong&gt;: Maximum 24-hour spending (e.g., $50)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;per_transaction_cap_usdc&lt;/strong&gt;: Individual transaction limit (e.g., $10)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;cooldown_seconds&lt;/strong&gt;: Minimum time between transactions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;allowed_recipients&lt;/strong&gt;: Optional allowlist of recipient addresses&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Only the wallet owner can modify policies; agents cannot override them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Connect Your Agent
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Option A: MCP Server
&lt;/h3&gt;

&lt;p&gt;Add configuration to your LLM environment's settings file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"mcpServers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"moltpe"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"npx"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"-y"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"@moltpe/mcp-server"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"env"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"MOLTPE_API_KEY"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"your-api-key-here"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"MOLTPE_WALLET_ID"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"your-wallet-id-here"&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After restarting, your agent gains access to payment tools: &lt;code&gt;check_balance&lt;/code&gt;, &lt;code&gt;send_payment&lt;/code&gt;, and &lt;code&gt;list_transactions&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Option B: REST API
&lt;/h3&gt;

&lt;p&gt;Standard HTTP endpoints for custom agents:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Check balance:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;GET https://api.moltpe.com/v1/wallet/balance
Headers: Authorization: Bearer YOUR_API_KEY
         X-Wallet-ID: YOUR_WALLET_ID
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Send payment:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;POST https://api.moltpe.com/v1/wallet/send
Body: &lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"to"&lt;/span&gt;: &lt;span class="s2"&gt;"0x..."&lt;/span&gt;, &lt;span class="s2"&gt;"amount_usdc"&lt;/span&gt;: &lt;span class="s2"&gt;"2.50"&lt;/span&gt;, &lt;span class="s2"&gt;"memo"&lt;/span&gt;: &lt;span class="s2"&gt;"..."&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Responses include transaction IDs and policy violation details.&lt;/p&gt;

&lt;h3&gt;
  
  
  Option C: x402 Protocol
&lt;/h3&gt;

&lt;p&gt;Enables automatic payment at the HTTP level:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Agent makes standard API request to x402-enabled service&lt;/li&gt;
&lt;li&gt;Server responds with 402 Payment Required status&lt;/li&gt;
&lt;li&gt;MoltPe wallet automatically pays and retries the request&lt;/li&gt;
&lt;li&gt;Server delivers the requested resource&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Payments are invisible to agent logic. Spending policies still apply.&lt;/p&gt;

&lt;h2&gt;
  
  
  Testing Your Integration
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Verify Balance&lt;/strong&gt;: Confirm your agent can read wallet balance accurately&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Send Test Payment&lt;/strong&gt;: Submit a small transaction and verify it appears in your dashboard&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Test Policy Enforcement&lt;/strong&gt;: Deliberately trigger policy violations to confirm they're blocked&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Review History&lt;/strong&gt;: Check transaction records in the dashboard&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Common Issues and Fixes
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Issue&lt;/th&gt;
&lt;th&gt;Solution&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Insufficient balance error&lt;/td&gt;
&lt;td&gt;Verify USDC was sent to correct network&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Policy rejection&lt;/td&gt;
&lt;td&gt;Check daily spending and per-transaction limits&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Wrong network&lt;/td&gt;
&lt;td&gt;Ensure API calls match wallet's configured network&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MCP tools not appearing&lt;/td&gt;
&lt;td&gt;Restart LLM environment and verify JSON syntax&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Setup time:&lt;/strong&gt; Under five minutes from signup to first payment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code requirements:&lt;/strong&gt; MCP requires only JSON configuration. x402 requires no custom code. REST API requires standard HTTP integration code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Testing without real funds:&lt;/strong&gt; Use demo.moltpe.com or deposit as little as $1 USDC (zero gas fees on supported chains).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Running out of funds:&lt;/strong&gt; Agent receives an insufficient balance error. No overdrafts possible. Wallet can be topped up anytime through the dashboard.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://moltpe.com/blog/how-to-add-payments-to-ai-agent" rel="noopener noreferrer"&gt;moltpe.com/blog/how-to-add-payments-to-ai-agent&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>blockchain</category>
      <category>tutorial</category>
      <category>webdev</category>
    </item>
    <item>
      <title>x402 Protocol: Complete Guide to HTTP-Native Micropayments</title>
      <dc:creator>Umang Gupta</dc:creator>
      <pubDate>Thu, 16 Apr 2026 12:50:33 +0000</pubDate>
      <link>https://dev.to/umangbuilds/x402-protocol-complete-guide-to-http-native-micropayments-2ne1</link>
      <guid>https://dev.to/umangbuilds/x402-protocol-complete-guide-to-http-native-micropayments-2ne1</guid>
      <description>&lt;p&gt;The x402 protocol brings payments directly into HTTP using the long-dormant 402 status code. This guide covers everything developers need to know about implementing HTTP-native micropayments for AI agents and APIs.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is the x402 Protocol?
&lt;/h2&gt;

&lt;p&gt;The x402 protocol is an open standard that enables payments directly within HTTP using the 402 Payment Required status code. Originally reserved in the 1999 HTTP/1.1 specification, this status code remained unused for over two decades until x402 provided a concrete implementation for machine-to-machine payments.&lt;/p&gt;

&lt;p&gt;x402 was designed specifically for software agents buying things from other software agents — eliminating account creation, payment method entry, and redirect flows typical of traditional systems.&lt;/p&gt;

&lt;p&gt;Key characteristics:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No pre-registration required&lt;/strong&gt; — clients can pay any server on first contact&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Machine-readable by default&lt;/strong&gt; — the entire flow occurs through HTTP headers&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Per-request granularity&lt;/strong&gt; — enables true micropayments from fractions of a cent to dollars&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How x402 Works
&lt;/h2&gt;

&lt;p&gt;The payment process follows five sequential steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Client Requests Resource&lt;/strong&gt; — sends a standard HTTP request&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Server Responds 402&lt;/strong&gt; — returns payment requirements via headers (amount, token, network, recipient, expiry)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Client Signs and Submits Payment&lt;/strong&gt; — constructs a blockchain transaction and resubmits the request with payment proof&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Server Verifies On-Chain&lt;/strong&gt; — validates transaction settlement&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Server Delivers Resource&lt;/strong&gt; — returns HTTP 200 with requested content&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Response headers include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;X-Payment-Amount&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;X-Payment-Token&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;X-Payment-Network&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;X-Payment-Recipient&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;X-Payment-Expiry&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  x402 vs Traditional Payment APIs
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Dimension&lt;/th&gt;
&lt;th&gt;Traditional APIs&lt;/th&gt;
&lt;th&gt;x402&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Authentication&lt;/td&gt;
&lt;td&gt;API keys, OAuth, session cookies&lt;/td&gt;
&lt;td&gt;Payment proof in HTTP header&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Payment Flow&lt;/td&gt;
&lt;td&gt;Multi-step with manual setup&lt;/td&gt;
&lt;td&gt;Two HTTP requests&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Settlement&lt;/td&gt;
&lt;td&gt;Days to weeks&lt;/td&gt;
&lt;td&gt;Seconds via blockchain&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fees&lt;/td&gt;
&lt;td&gt;2.9% + $0.30 per transaction&lt;/td&gt;
&lt;td&gt;Fraction of a cent in gas&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Machine-Readable&lt;/td&gt;
&lt;td&gt;Partially, requires SDK&lt;/td&gt;
&lt;td&gt;Fully, standardized headers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Setup Complexity&lt;/td&gt;
&lt;td&gt;High, requires KYC, PCI compliance&lt;/td&gt;
&lt;td&gt;Low, wallet address plus headers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Micropayments&lt;/td&gt;
&lt;td&gt;Impractical, ~$0.50 minimum&lt;/td&gt;
&lt;td&gt;Native, viable at $0.001+&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Code Examples
&lt;/h2&gt;

&lt;h3&gt;
  
  
  cURL Implementation
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Step 1: Initial request&lt;/span&gt;
curl &lt;span class="nt"&gt;-i&lt;/span&gt; https://api.example.com/v1/premium-data

&lt;span class="c"&gt;# Response includes:&lt;/span&gt;
&lt;span class="c"&gt;# X-Payment-Amount: 1000&lt;/span&gt;
&lt;span class="c"&gt;# X-Payment-Token: 0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359&lt;/span&gt;
&lt;span class="c"&gt;# X-Payment-Network: polygon&lt;/span&gt;
&lt;span class="c"&gt;# X-Payment-Recipient: 0x8f2e...c9E2&lt;/span&gt;
&lt;span class="c"&gt;# X-Payment-Expiry: 1713312000&lt;/span&gt;

&lt;span class="c"&gt;# Step 2: Retry with proof after on-chain payment&lt;/span&gt;
curl &lt;span class="nt"&gt;-i&lt;/span&gt; https://api.example.com/v1/premium-data &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"X-Payment-Proof: 0xabc123..."&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  JavaScript/Node.js
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;x402Fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;options&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{})&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;initialResponse&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;options&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;initialResponse&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;status&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="mi"&gt;402&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;initialResponse&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;paymentAmount&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;initialResponse&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;X-Payment-Amount&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;paymentToken&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;initialResponse&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;X-Payment-Token&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;paymentNetwork&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;initialResponse&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;X-Payment-Network&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;paymentRecipient&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;initialResponse&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;X-Payment-Recipient&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;paymentExpiry&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;initialResponse&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;X-Payment-Expiry&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;parseInt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;paymentExpiry&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Payment window expired, retry to get new terms&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;txHash&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;submitPayment&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;to&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;paymentRecipient&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;paymentAmount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;token&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;paymentToken&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;network&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;paymentNetwork&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;paidResponse&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;options&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;options&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;X-Payment-Proof&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;txHash&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;paidResponse&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;x402Fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://api.example.com/v1/premium-data&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Python
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;x402_request&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;method&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;GET&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;kwargs&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;request&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;method&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;kwargs&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status_code&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="mi"&gt;402&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;

    &lt;span class="n"&gt;payment_requirements&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;amount&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;X-Payment-Amount&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;token&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;X-Payment-Token&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;network&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;X-Payment-Network&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;recipient&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;X-Payment-Recipient&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;expiry&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;X-Payment-Expiry&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;time&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;payment_requirements&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;expiry&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]):&lt;/span&gt;
        &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Payment window expired&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;tx_hash&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;submit_payment&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;payment_requirements&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;recipient&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;payment_requirements&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;amount&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;payment_requirements&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;token&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="n"&gt;network&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;payment_requirements&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;network&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;headers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;kwargs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pop&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;headers&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{})&lt;/span&gt;
    &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;X-Payment-Proof&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;tx_hash&lt;/span&gt;

    &lt;span class="n"&gt;paid_response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;request&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;method&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;kwargs&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;paid_response&lt;/span&gt;

&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;x402_request&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://api.example.com/v1/premium-data&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Integrating x402 with MoltPe
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://moltpe.com" rel="noopener noreferrer"&gt;MoltPe&lt;/a&gt; supports x402 natively with automatic payment handling:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Automatic 402 detection and header extraction&lt;/li&gt;
&lt;li&gt;Policy-checked signing before payment&lt;/li&gt;
&lt;li&gt;Gasless settlement (sponsored gas on Polygon PoS, Base, Tempo)&lt;/li&gt;
&lt;li&gt;Automatic retry with payment proof&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  MCP Tool Call
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"tool"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"call_x402_endpoint"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"arguments"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://api.example.com/v1/premium-data"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"method"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"GET"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"max_payment"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"0.01"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  REST API
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;POST https://api.moltpe.com/v1/x402/proxy
Authorization: Bearer YOUR_AGENT_TOKEN
Content-Type: application/json

&lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="s2"&gt;"target_url"&lt;/span&gt;: &lt;span class="s2"&gt;"https://api.example.com/v1/premium-data"&lt;/span&gt;,
  &lt;span class="s2"&gt;"method"&lt;/span&gt;: &lt;span class="s2"&gt;"GET"&lt;/span&gt;,
  &lt;span class="s2"&gt;"max_payment_usd"&lt;/span&gt;: &lt;span class="s2"&gt;"0.01"&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;MoltPe agents can also collect payments by configuring as sellers, with automatic 402 header generation and on-chain verification.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use Cases
&lt;/h2&gt;

&lt;h3&gt;
  
  
  API Monetization
&lt;/h3&gt;

&lt;p&gt;Servers can charge for access without managing API keys or billing infrastructure, using x402 as the sole access control mechanism.&lt;/p&gt;

&lt;h3&gt;
  
  
  Data Marketplace
&lt;/h3&gt;

&lt;p&gt;Agents pay exactly for what they use, and providers earn exactly for what they serve — enabling economically viable niche data sales.&lt;/p&gt;

&lt;h3&gt;
  
  
  Agent-to-Agent Services
&lt;/h3&gt;

&lt;p&gt;Specialized agents can charge other agents for services — translation, code review, market analysis — without invoicing overhead.&lt;/p&gt;

&lt;h3&gt;
  
  
  Content Paywalls
&lt;/h3&gt;

&lt;p&gt;Publishers can charge per-article instead of requiring subscriptions, appealing to both humans and agents accessing content across multiple providers.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What does x402 stand for?&lt;/strong&gt;&lt;br&gt;
The protocol references HTTP status code 402 (Payment Required), with "x" indicating experimental status.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is x402 a blockchain protocol?&lt;/strong&gt;&lt;br&gt;
x402 is an HTTP-layer protocol that uses blockchain for payment settlement. It remains network-agnostic and compatible with EVM-compatible chains.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Who created x402?&lt;/strong&gt;&lt;br&gt;
Coinbase pioneered the specification and reference implementation, which has since gained adoption across multiple platforms.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can x402 handle large payments?&lt;/strong&gt;&lt;br&gt;
Yes — there are no protocol-level limits. Payment amounts are server-specified via headers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How does x402 compare to Lightning Network?&lt;/strong&gt;&lt;br&gt;
Lightning operates as a Layer 2 payment channel network on Bitcoin, while x402 operates at the HTTP layer on EVM chains using stablecoins like USDC.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://moltpe.com/blog/x402-protocol-complete-guide" rel="noopener noreferrer"&gt;moltpe.com/blog/x402-protocol-complete-guide&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>blockchain</category>
      <category>api</category>
      <category>payments</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>What Are AI Agent Payments? Complete Guide (2026)</title>
      <dc:creator>Umang Gupta</dc:creator>
      <pubDate>Thu, 16 Apr 2026 12:44:10 +0000</pubDate>
      <link>https://dev.to/umangbuilds/what-are-ai-agent-payments-complete-guide-2026-4aa4</link>
      <guid>https://dev.to/umangbuilds/what-are-ai-agent-payments-complete-guide-2026-4aa4</guid>
      <description>&lt;p&gt;AI agent payments represent a paradigm shift in how autonomous systems handle financial transactions. Rather than requiring human intervention for each transaction, AI systems can now independently manage funds through isolated wallets while adhering to programmable spending boundaries. Platforms like &lt;a href="https://moltpe.com" rel="noopener noreferrer"&gt;MoltPe&lt;/a&gt; provide the infrastructure enabling these autonomous transactions to settle in stablecoins with minimal latency and zero blockchain fees.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Rise of Autonomous AI Transactions
&lt;/h2&gt;

&lt;p&gt;The payments landscape experienced dramatic transformation in 2025. Stablecoin transaction volume exceeded $33 trillion, surpassing traditional card networks. Major financial institutions recognized this shift: Visa launched stablecoin infrastructure, Stripe acquired Bridge for $1.1 billion, and Coinbase deployed agent-compatible USDC systems.&lt;/p&gt;

&lt;p&gt;The underlying driver is straightforward. Contemporary AI agents already execute complex financial tasks—booking travel, provisioning cloud resources, accessing paid APIs, and managing software subscriptions. Yet today's systems typically force agents into one of two suboptimal positions: returning transactions to the user for approval or relying on pre-authorized tokens with inadequate spending controls.&lt;/p&gt;

&lt;p&gt;Agent payment infrastructure closes this gap. It enables autonomous systems to maintain fund balances, evaluate transaction costs, and execute payments within owner-defined parameters.&lt;/p&gt;

&lt;h2&gt;
  
  
  How AI Agent Payments Work
&lt;/h2&gt;

&lt;p&gt;An agent payment follows a predictable sequence:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;TASK RECEIVED&lt;/strong&gt; - Agent receives instruction to complete a spending-related task&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;WALLET CHECK&lt;/strong&gt; - Agent queries its isolated wallet balance&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;POLICY EVALUATION&lt;/strong&gt; - Agent verifies transaction complies with daily limits, per-transaction caps, and recipient restrictions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PAYMENT EXECUTION&lt;/strong&gt; - Agent signs an EIP-712 typed transaction and submits USDC transfer&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SETTLEMENT CONFIRMED&lt;/strong&gt; - On-chain confirmation occurs within ~500ms&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Each step operates automatically without requiring callbacks, approval workflows, or stored financial credentials. The agent's wallet contains only allocated operational funds, while spending policies function as automated safeguards replacing traditional human review.&lt;/p&gt;

&lt;h2&gt;
  
  
  Traditional Payments vs Agent Payments
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Dimension&lt;/th&gt;
&lt;th&gt;Traditional Payments&lt;/th&gt;
&lt;th&gt;AI Agent Payments&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Initiation&lt;/td&gt;
&lt;td&gt;Human approval required&lt;/td&gt;
&lt;td&gt;Autonomous, policy-driven&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Speed&lt;/td&gt;
&lt;td&gt;2-5 business days&lt;/td&gt;
&lt;td&gt;Sub-second finality&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fees&lt;/td&gt;
&lt;td&gt;2-3% interchange + processing&lt;/td&gt;
&lt;td&gt;Zero gas fees (supported chains)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Limits&lt;/td&gt;
&lt;td&gt;Card limits, issuer-set caps&lt;/td&gt;
&lt;td&gt;Programmable daily limits, per-transaction caps&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Settlement&lt;/td&gt;
&lt;td&gt;T+1 to T+3&lt;/td&gt;
&lt;td&gt;Instant, on-chain, verifiable&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Key Protocols Powering Agent Payments
&lt;/h2&gt;

&lt;h3&gt;
  
  
  x402: HTTP-Native Micropayments
&lt;/h3&gt;

&lt;p&gt;The x402 protocol repurposes the HTTP 402 status code as a functional payment mechanism. When an agent calls a paid API, servers respond with &lt;code&gt;402 Payment Required&lt;/code&gt; including pricing details. The agent's wallet automatically constructs a USDC payment signature, includes it in the request header, and retries the call.&lt;/p&gt;

&lt;h3&gt;
  
  
  MPP: Machine Payments Protocol
&lt;/h3&gt;

&lt;p&gt;MPP standardizes machine-to-machine payment discovery, negotiation, and execution. It handles service pricing discovery, volume discount negotiation, and payment routing across blockchains.&lt;/p&gt;

&lt;h3&gt;
  
  
  MCP: Model Context Protocol
&lt;/h3&gt;

&lt;p&gt;MCP enables large language models to interact with payment infrastructure through standardized interfaces. &lt;a href="https://moltpe.com/guide" rel="noopener noreferrer"&gt;MoltPe's MCP server&lt;/a&gt; allows LLMs running in Claude Desktop, Cursor, or Windsurf to check balances, send payments, and review transaction history through natural language commands.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Spending Policies Matter
&lt;/h2&gt;

&lt;p&gt;Granting agent access to funds without spending controls introduces unnecessary risk:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Runaway loops&lt;/strong&gt; - Agents encountering retry patterns purchase identical resources hundreds of times&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Price manipulation&lt;/strong&gt; - Malicious APIs increase prices mid-session&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Prompt injection&lt;/strong&gt; - Attackers craft inputs instructing agents to transfer funds&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scope creep&lt;/strong&gt; - Agents acquire resources outside their mandate&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;MoltPe agent wallets support configurable policies enforcing rules at the infrastructure level:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Daily spending limits&lt;/strong&gt; - Cap 24-hour total outflows&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Per-transaction caps&lt;/strong&gt; - Reject payments exceeding thresholds&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Recipient allowlists&lt;/strong&gt; - Restrict payments to pre-approved addresses&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cooldown periods&lt;/strong&gt; - Enforce minimum intervals between transactions&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Getting Started in 5 Minutes
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 1: Create an Agent Wallet
&lt;/h3&gt;

&lt;p&gt;Access &lt;a href="https://moltpe.com" rel="noopener noreferrer"&gt;moltpe.com&lt;/a&gt; to create a new agent wallet. Each wallet operates independently with its own balance and spending policies. Wallets employ non-custodial architecture via Shamir key splitting.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Fund It and Set Policies
&lt;/h3&gt;

&lt;p&gt;Transfer USDC to your agent's wallet on Polygon PoS, Base, or Tempo. Configure spending policies: daily limits, per-transaction maximums, and optionally restrict payable addresses.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Connect Your Agent
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;MCP&lt;/strong&gt; - For Claude Desktop, Cursor, or Windsurf&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;x402&lt;/strong&gt; - For automatic payment handling on paid APIs&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;REST API&lt;/strong&gt; - For custom agents with any language/framework&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What are AI agent payments?&lt;/strong&gt;&lt;br&gt;
Financial transactions initiated, authorized, and completed by autonomous AI systems without requiring human approval each time. Agents maintain isolated wallets and settle in USDC stablecoins.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do AI agents make payments without human approval?&lt;/strong&gt;&lt;br&gt;
Agents operate within owner-defined spending policies. Transactions within guardrails execute autonomously. Transactions exceeding limits are automatically rejected.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is it secure?&lt;/strong&gt;&lt;br&gt;
MoltPe employs non-custodial Shamir key splitting, AES-256-GCM encryption, TLS 1.3, and EIP-712 typed signatures. Spending policies enforce limits at the infrastructure level.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How much does it cost?&lt;/strong&gt;&lt;br&gt;
MoltPe provides a free tier including wallet creation, spending policies, and zero gas fees on Polygon PoS, Base, and Tempo. No platform fees or setup costs.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://moltpe.com/blog/what-are-ai-agent-payments" rel="noopener noreferrer"&gt;moltpe.com&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>blockchain</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
