Connect an AI Agent to Stripe with n8n
Updated 2026-10-28
You connect an AI agent to Stripe in n8n with a Stripe secret key and the HTTP Request node attached as a tool. This guide limits the agent to two reads, the account balance and a short customer list. It does not create charges. Last tested 2026-10-20.
The Stripe node in n8n can get a balance and list customers, but its docs do not say it can be used as an AI tool. The HTTP Request node does. Use that node when the agent itself must decide to call Stripe.
Prerequisites
- n8n Cloud or self-hosted n8n, with a current AI Agent node. n8n deprecated the agent type setting in 1.82.0.
- A Stripe account. Use a test mode secret key until you mean to read live data.
- A chat model credential in n8n.
Docs used for the steps below:
- HTTP Request node, including tool use
- Stripe credentials
- Retrieve balance
- List customers
- AI Agent node
- AI Agent common issues
Steps
1. Create a Stripe credential in test mode
n8n authenticates the Stripe node with a secret key. The same credential is what you select later as a predefined credential on HTTP Request.
- Open the Stripe test mode dashboard and select API keys. Stripe’s page is Developers, then API keys, in test mode.
- In Standard keys, select Reveal test key for the secret key.
- Copy the key. Test secret keys start with
sk_test_. Live secret keys start withsk_live_. - In n8n, create a Stripe credential and paste the key into Secret Key.
Do not paste a publishable key. Those start with pk_. n8n has not tested restricted keys that start with rk_. Keep the test key and the live key in separate n8n credentials. Objects in one mode are not visible to the other.
2. Add the AI Agent and a chat model
- Add an AI Agent node and connect a chat model. The agent must have a chat model or n8n stops with “A Chat Model sub-node must be connected”.
- Add a Chat Trigger for the chat panel. Leave Prompt on Connected Chat Trigger Node.
- You will attach two HTTP Request tools in the next steps. The agent node requires at least one tool.
Optional: add n8n AI agent memory before you test multi-turn questions like “list customers again, but only in test mode.”
3. Add a balance tool
Attach an HTTP Request node to the AI Agent as a tool. n8n’s HTTP Request docs say you can use that node attached to an AI agent.
- Set Method to GET.
- Set URL to
https://api.stripe.com/v1/balance. - Set Authentication to Predefined Credential Type. Select Stripe, then the test credential from step 1. n8n recommends predefined credentials when the service is one it already supports.
- Name the tool something the model can read, such as
stripe_balance. - Optional, under the tool-only options: turn on Optimize Response, choose JSON, and include the
availableandpendingfields so the model does not receive the whole payload.
Stripe’s retrieve-balance sample is the same request. The placeholder is the secret key:
curl https://api.stripe.com/v1/balance \
-u "<<YOUR_SECRET_KEY>>"
The JSON body includes available, pending, and livemode. Read those fields from the response. Do not treat amount as a decimal dollar value unless Stripe’s field description for that currency says so.
4. Add a list-customers tool
Add a second HTTP Request tool on the same agent.
- Method GET.
- URL
https://api.stripe.com/v1/customers. - Authentication, Predefined Credential Type, the same Stripe test credential.
- Turn on Send Query Parameters. Add a parameter named
limitwith value3. Stripe’s list endpoint acceptslimitfrom 1 to 100. The default is 10. The official sample useslimit=3. - Leave the URL fixed. Do not let the model edit the URL, or it can call a write endpoint.
To filter by email, add a query parameter named email. Stripe treats that value as an exact, case-sensitive match. You can let the model fill only that value:
{{ $fromAI('email', 'Exact customer email to look up', 'string') }}
$fromAI() is documented for tools connected to the AI Agent. The key is a hint, not a Stripe field name.
5. Ask a read-only question
In the chat panel, ask “What is my Stripe balance?” and then “List three customers.” The execution log should show GET requests to /v1/balance and /v1/customers. livemode on the balance object is false when the key is a test key.
Common errors
401 from Stripe. The credential holds a publishable key, a revoked key, or a live key while you are looking at test data. Reveal the test secret key again and save a separate credential.
The agent creates a charge. A tool URL is a POST to /v1/charges, or you attached a Stripe node operation named Create a charge. This guide uses GET only. Delete any tool whose method is not GET.
A Chat Model sub-node must be connected, or No prompt specified. Connect the chat model. If the prompt error remains, set the AI Agent Prompt to Define below and reference chatInput, which is the field n8n names in the common issues page.
400 Invalid value for ‘content’, got null. The prompt expression or chatInput is null. Send a non-empty chat message.
Customer list is empty. The test key and the live key do not share customers. Confirm the credential is the mode that holds the customers you created.
FAQ
How do I connect an AI agent to Stripe with n8n?
Store a Stripe test secret key in an n8n Stripe credential. Add an AI Agent with a chat model, then attach HTTP Request tools that GET https://api.stripe.com/v1/balance and https://api.stripe.com/v1/customers with that credential.
Why not attach the Stripe node as the tool?
n8n’s Stripe node page does not say the node can be used as an AI tool. The HTTP Request node page does. Predefined Credential Type still uses the Stripe credential you created.
Can this agent charge a card?
Not with the tools in this guide. Both tools are GET requests. Do not add a POST to /v1/charges unless a person reviews the amount outside the agent.
Related guides
- Connect an AI agent to HubSpot with n8n
- GitHub MCP server (tie billing reads to repo or issue context in Cursor)
- n8n AI agent memory
- Connect an AI agent to a database
- What is an AI agent?
- Build an AI agent that books meetings