How to connect Stripe with Claude Code (4 steps)
.png)
Developers building billing logic, subscription workflows, or payment integrations spend a lot of time in two places at once: the terminal and the Stripe dashboard.
Debugging a failed charge means looking up the payment intent. Validating subscription state means checking the customer record. Testing a refund flow means cross-referencing the original charge. Every one of those lookups is a context switch.
To help your developers query and act on Stripe data directly from their coding session, we'll show you how to connect Stripe with Merge Agent Handler's Stripe MCP server.
How it works
Merge Agent Handler connects Claude Code to Stripe's API through a single CLI setup. You install the Merge CLI, authenticate once, and register the connection with one command. Agent Handler manages your Stripe credentials so you don't keep secret keys in your local environment or embed them in your codebase.
Here's the command that registers the connection:
Prerequisites
Before getting started, you'll need the following:
- A Merge Agent Handler account
- Claude Code installed (run
claude --versionto confirm) - pipx installed (run
pipx --versionto confirm, or install viapip install pipx) - A Stripe account with API access
If you want to connect Merge Agent Handler's Stripe MCP with internal or customer-facing agentic products, you can follow the steps in our docs.
1. Install the Merge CLI
Install with pipx: pipx install merge-api

Verify your installation: merge --version

Related: How to use the FactSet MCP in Claude Code
2. Configure the CLI and log in
Authenticate the CLI with your Merge Agent Handler account: merge login
Once complete, the CLI can make authorized API requests on your behalf.
3. Add Agent Handler to Claude Code
The simplest way to register Agent Handler with Claude Code:
Alternatively, register manually:
Verify the connection registered. Open Claude Code and run: /mcp
agent-handler should appear under Local MCPs with a connected status.

4. Authenticate Stripe
To confirm the connection is working, open a Claude Code session and try: "List my failed payment intents from the last 7 days and tell me what the most common decline reason is."
On first use, a Magic Link will appear to finish connector authentication.

You should then see a response like the following:

{{this-blog-only-cta}}
Stripe MCP FAQ
In case you have more questions on setting up and using the Stripe MCP in Claude Code, we've addressed several more commonly-asked questions below.
What can you do once the Stripe MCP is connected to Claude Code?
With Stripe connected, Claude Code can:
- Retrieve and search payment intents: pull up payment intent status, decline codes, and metadata without opening the dashboard or writing a one-off API call
- Look up customers and subscriptions: fetch customer records, active subscriptions, and payment method details from within a coding session
- List and inspect invoices: retrieve invoice status, line items, and payment history for any customer to validate billing logic against real data
- Create and track refunds: issue refunds and check their status directly from the terminal, useful when testing cancellation or return flows
- Pull balance and payout data: check current balance, review payout schedules, and list recent balance transactions to verify settlement behavior
- Search charges by customer or date range: surface recent charges filtered by status or metadata to debug a specific transaction or audit a billing run
Why use Merge Agent Handler vs. a self-hosted Stripe MCP server?
You can build a self-hosted MCP server that calls Stripe's API directly. For a solo developer working against a test mode account, that's a workable starting point. You store a secret key, write tool schemas for the endpoints you need, and connect it to Claude Code.
The problem is what happens when more than one person needs access, or when you're working against live mode data.
Stripe secret keys carry full account access by default. Sharing them across developers, or handing one to an agent with no access controls on top, means the agent can read customer PII, issue refunds, cancel subscriptions, or pull balance data, whether or not your use case requires it. There's no audit trail of what the agent did, and revoking a key breaks everyone using it.
Merge Agent Handler sits between Claude Code and Stripe. You define exactly which tools each Tool Pack exposes, so a read-only reporting agent never gets a <code class="blog_inline-code">create_refund</code> tool. Every call is logged with the tool name, inputs, and response metadata. And each developer or environment gets its own Registered User with its own scoped credentials, so access is isolated and revocable without touching anyone else's setup.
For teams building agents against live Stripe data, the per-developer credential problem and the lack of access controls are the failure modes that matter. Merge Agent Handler addresses both.
Why connect Stripe to Claude Code?
Stripe is the source of truth for revenue data. Every charge, subscription, invoice, and payout lives there, and developers building billing agents, RevOps tooling, or payment debugging workflows need to reach it constantly. Right now that means a browser tab, a Stripe CLI command, or a throwaway script.
With the Stripe MCP connected, Claude Code can query payment intents, pull subscription state, and surface customer billing history without leaving the terminal.
That changes how debugging works: instead of tracing a failed payment across logs, a webhook event, and a manual API call to reconstruct the charge, you can ask Claude Code to pull the payment intent directly and explain what happened.
It also changes how testing works: agents validating billing logic can check live Stripe state mid-session rather than relying on fixtures that may not reflect production behavior.
.avif)
.avif)




