<?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: PalabreX</title>
    <description>The latest articles on DEV Community by PalabreX (@palabrex).</description>
    <link>https://dev.to/palabrex</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%2F3999566%2Ff0badd2a-c0f0-46a5-a5e1-d16929f9af34.png</url>
      <title>DEV Community: PalabreX</title>
      <link>https://dev.to/palabrex</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/palabrex"/>
    <language>en</language>
    <item>
      <title>I built a Stripe-native marketplace where AI agents pay for APIs automatically</title>
      <dc:creator>PalabreX</dc:creator>
      <pubDate>Wed, 24 Jun 2026 00:41:34 +0000</pubDate>
      <link>https://dev.to/palabrex/i-built-a-stripe-native-marketplace-where-ai-agents-pay-for-apis-automatically-8gf</link>
      <guid>https://dev.to/palabrex/i-built-a-stripe-native-marketplace-where-ai-agents-pay-for-apis-automatically-8gf</guid>
      <description>&lt;h1&gt;
  
  
  I built a Stripe-native marketplace where AI agents pay for APIs automatically
&lt;/h1&gt;

&lt;p&gt;A few weeks ago, Stripe shipped their &lt;strong&gt;Agent Toolkit&lt;/strong&gt; — a way for AI agents to hold a payment method and spend money programmatically. I read the announcement and immediately thought: &lt;em&gt;there's nowhere for agents to actually spend this money.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;So I built one. This is the story of how, plus the technical decisions and dead ends along the way.&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem
&lt;/h2&gt;

&lt;p&gt;AI agents increasingly need to call external services — scrape a page, validate a phone number, generate a PDF. Today, that means one of three things for the developer wiring it up:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Hardcode an API key for every service the agent might need&lt;/li&gt;
&lt;li&gt;Build a custom billing integration per provider&lt;/li&gt;
&lt;li&gt;Maintain a growing pile of subscriptions for services the agent calls a handful of times&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of this is agent-native. An agent that discovers it needs a capability mid-task has no standard way to find a provider and pay for exactly what it uses.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;MCP (Model Context Protocol)&lt;/strong&gt; solves half of this — it standardizes how agents discover and call tools. Stripe Agent Toolkit solves the other half — it lets an agent actually pay for something. Nobody had connected the two into an actual marketplace. That's &lt;a href="https://getrunpay.com" rel="noopener noreferrer"&gt;run.pay&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it works
&lt;/h2&gt;

&lt;p&gt;Two sides, one backend:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sellers&lt;/strong&gt; publish any API as a service with a price per call. A scraper, a validator, anything that returns JSON.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Agents&lt;/strong&gt; connect once via an MCP endpoint and discover the entire catalog automatically:&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;"runpay"&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://runpay-backend-visibility-production.up.railway.app/mcp"&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;From there, calling a service and paying for it is one request:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-X&lt;/span&gt; POST https://runpay-backend-visibility-production.up.railway.app/api/call/SERVICE_ID &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{"agent_id":"my-agent","payload":{"phone":"+33612345678"}}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Stripe charges the agent's attached card, the request is forwarded to the seller's endpoint, the result comes back. The seller gets paid via Stripe Connect. Nobody touches a dashboard.&lt;/p&gt;

&lt;h2&gt;
  
  
  The architecture
&lt;/h2&gt;

&lt;p&gt;Pretty boring on purpose — boring is reliable:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Backend&lt;/strong&gt;: Node.js + Express on Railway&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Database&lt;/strong&gt;: PostgreSQL (also Railway)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Payments&lt;/strong&gt;: Stripe Connect for payouts, a custom wrapper around the Payment Intents API for per-call charging&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Discovery&lt;/strong&gt;: a standard MCP server exposing &lt;code&gt;list_services&lt;/code&gt; and &lt;code&gt;call_service&lt;/code&gt; as tools&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Email&lt;/strong&gt;: Resend, for vendor onboarding and sale notifications&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The interesting part isn't any single piece — it's how the payment flow has to behave for an &lt;em&gt;autonomous&lt;/em&gt; caller.&lt;/p&gt;

&lt;h2&gt;
  
  
  What broke, and why
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Stripe's minimum charge amount
&lt;/h3&gt;

&lt;p&gt;My first instinct was to price services the way Twilio or AbstractAPI do — fractions of a cent per call. That's the right end-user price, but Stripe enforces a minimum charge (~$0.50 depending on currency), and on top of that takes a flat fee per transaction. Charging $0.01 per call means losing money on Stripe's fee alone.&lt;/p&gt;

&lt;p&gt;The fix for v1 was pragmatic: price services at $0.60+ so a single Stripe charge clears the minimum and the fee stays a small percentage. It's not the long-term answer — a credit-based system (buy $10 of credits in one transaction, debit fractions of a cent per call) is the real fix, and it's next on the roadmap. But it would have delayed launch by weeks, and getting a working pay-per-call loop in front of people mattered more than getting the unit economics perfect on day one.&lt;/p&gt;

&lt;h3&gt;
  
  
  Auto-refunding failed calls
&lt;/h3&gt;

&lt;p&gt;If a seller's endpoint times out or returns a 500, the agent has already been charged. There's no acceptable version of "sorry, no refund" when the thing that failed wasn't the agent's fault. So &lt;code&gt;/api/call/:id&lt;/code&gt; wraps the seller request in a try/catch that triggers an automatic Stripe refund on any non-2xx response or timeout, before the error even reaches the agent. The agent sees a clean failure with &lt;code&gt;refunded: true&lt;/code&gt; instead of a silent charge for nothing.&lt;/p&gt;

&lt;h3&gt;
  
  
  Designing the MCP surface for a marketplace, not a single tool
&lt;/h3&gt;

&lt;p&gt;Most MCP servers I looked at expose a fixed set of tools — one server, one capability. A marketplace needs a different shape: one stable tool (&lt;code&gt;call_service&lt;/code&gt;) that takes a dynamic service ID, plus a discovery tool (&lt;code&gt;list_services&lt;/code&gt;) that returns whatever the catalog currently contains. The catalog changes as vendors join; the MCP surface itself shouldn't need to change. That distinction took a couple of false starts to get right — my first version tried to generate a new MCP tool per service, which works until you have 50 services and an agent's context window is full of tool definitions it'll never call.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where it's at
&lt;/h2&gt;

&lt;p&gt;Six services live right now — phone validation, web scraping, PDF generation, screenshot capture, plus batch variants of a couple of them. One real Stripe transaction has cleared the full loop: charge, call, refund-on-failure logic untested-in-anger (good), result returned to the agent in under two seconds.&lt;/p&gt;

&lt;p&gt;The harder problem now isn't technical — it's the standard cold-start problem for any marketplace. Sellers won't list services with zero agents calling them; agents have no reason to integrate a marketplace with zero services. I've spent the last week doing the unglamorous work: building services myself to seed the catalog, manually reaching out to MCP server maintainers who already have something worth monetizing, getting indexed on &lt;a href="https://glama.ai/mcp/servers" rel="noopener noreferrer"&gt;Smithery&lt;/a&gt; and the &lt;a href="https://github.com/punkpeye/awesome-mcp-servers" rel="noopener noreferrer"&gt;awesome-mcp-servers&lt;/a&gt; list.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'd tell someone building something similar
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Price for Stripe's economics first, your ideal economics second.&lt;/strong&gt; I lost a day discovering the minimum-charge issue in production instead of reading Stripe's docs more carefully upfront.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Auto-refund anything that wasn't the caller's fault.&lt;/strong&gt; An autonomous agent can't dispute a charge. If your system charges before it confirms success, it needs to un-charge automatically when that confirmation never arrives.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Design the discovery layer to scale independently of the catalog.&lt;/strong&gt; If your MCP surface has to change every time someone adds a service, you've built a single-tenant integration, not a marketplace.&lt;/p&gt;




&lt;p&gt;run.pay is live at &lt;a href="https://getrunpay.com" rel="noopener noreferrer"&gt;getrunpay.com&lt;/a&gt;. The &lt;a href="https://getrunpay.com/docs.html" rel="noopener noreferrer"&gt;docs&lt;/a&gt; have copy-pasteable curl examples for every service, and there's a sandbox mode if you want to test the flow without a real charge. The &lt;a href="https://github.com/PalabreX/runpay-mcp" rel="noopener noreferrer"&gt;MCP server source&lt;/a&gt; and a Python SDK are both on GitHub.&lt;/p&gt;

&lt;p&gt;If you maintain an MCP server with something worth monetizing, or you're building an agent that needs to call external services, I'd genuinely like to hear what would make a marketplace like this useful to you.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>mcp</category>
      <category>stripe</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
