<?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: ihen404</title>
    <description>The latest articles on DEV Community by ihen404 (@ihen404).</description>
    <link>https://dev.to/ihen404</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%2F4100679%2F247f990d-183e-4ba8-b4b2-5a2880d31a11.png</url>
      <title>DEV Community: ihen404</title>
      <link>https://dev.to/ihen404</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ihen404"/>
    <language>en</language>
    <item>
      <title>Monetize Express.js APIs for AI Agents in 3 Lines of Code with x402</title>
      <dc:creator>ihen404</dc:creator>
      <pubDate>Sat, 29 Aug 2026 19:15:50 +0000</pubDate>
      <link>https://dev.to/ihen404/monetize-expressjs-apis-for-ai-agents-in-3-lines-of-code-with-x402-4i0l</link>
      <guid>https://dev.to/ihen404/monetize-expressjs-apis-for-ai-agents-in-3-lines-of-code-with-x402-4i0l</guid>
      <description>&lt;p&gt;AI agents are increasingly making programmatic requests, but traditional billing (credit cards, OAuth, complex API keys) creates friction for automated microtransactions. &lt;/p&gt;

&lt;p&gt;With &lt;strong&gt;x402-express&lt;/strong&gt;, you can monetize any Express.js endpoint using HTTP 402 payment requirements on Base in 3 lines of code.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Installation
&lt;/h3&gt;

&lt;p&gt;bash&lt;br&gt;
npm install x402-express&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Implementation
&lt;/h3&gt;

&lt;p&gt;Add the middleware to any route you want to protect:&lt;br&gt;
javascript&lt;br&gt;
const express = require('express');&lt;br&gt;
const { x402Middleware } = require('x402-express');&lt;/p&gt;

&lt;p&gt;const app = express();&lt;/p&gt;

&lt;p&gt;app.get('/api/agent-data', x402Middleware({ price: '0.01' }), (req, res) =&amp;gt; {&lt;br&gt;
res.json({ message: "Payment verified via x402!" });&lt;br&gt;
});&lt;/p&gt;

&lt;p&gt;app.listen(3000, () =&amp;gt; console.log('Server running on port 3000'));&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Verification &amp;amp; Registry
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub Repository:&lt;/strong&gt; &lt;a href="https://github.com/IkeHentrel/x402-express" rel="noopener noreferrer"&gt;github.com/IkeHentrel/x402-express&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MCP Registry:&lt;/strong&gt; &lt;code&gt;io.github.ihen404/x402-express&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When an unauthenticated agent hits your endpoint, &lt;code&gt;x402-express&lt;/code&gt; interceptively returns an &lt;code&gt;HTTP 402 Payment Required&lt;/code&gt; payload containing payment parameters, verifying settlements autonomously.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>web3</category>
      <category>express</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
