Connect Stripe to a tool built with Claude or ChatGPT (2026)
Your tool built with Claude needs to read Stripe’s payments: failed charges to follow up, unpaid invoices, the month’s revenue. The Stripe credential touches your customers' money, and it must end up neither in the code nor in the conversation. On while, it stays in while, and your AI never sees it. Here is how.
By Aloïs Oddon, co-founder of Nextmap. Facts checked on November 18, 2026.
Stripe holds your payments, customers, subscriptions and invoices. A tool built with Claude or ChatGPT becomes valuable when it reads that data: the list of failed payments to follow up, unpaid invoices, the month’s revenue by plan. To do that, it needs a Stripe API credential, and that credential touches your customers’ money.
That is where things often go wrong: the secret key ends up pasted into the code, or into the conversation with the AI, where it can leak. On while, the Stripe credential stays in while. The tool calls Stripe without ever holding it, and your AI never sees it.
The short version. Create a restricted key in Stripe, read only if the tool writes nothing. Ask your AI to connect Stripe, then paste the key into while through the link it gives you. The tool reads your payments, every call is logged, and a refund waits for your approval if you ask.
Secret key or restricted key: which one to give
Stripe offers several kinds of keys, and only one fits a tool1,2.
| Secret key | Restricted key | |
|---|---|---|
| It starts with | sk_live_ or sk_test_ | rk_live_ or rk_test_ |
| What it opens | The whole account, with no restriction | Only the resources you choose |
| Permissions | Cannot be reduced | None, Read or Write, resource by resource |
| Stripe’s advice | Not advised for new uses | Recommended for most uses |
A restricted key limits the risk to what you allowed. If the tool only reads, it cannot write anything, even with the key in hand.
Connect Stripe to your tool, in three steps
The whole thing takes a few minutes, and you have no code to write.
- Create a restricted key in Stripe. On the Dashboard’s API keys page, click Create restricted key. For each resource, choose None, Read or Write, for example read access to payments, customers and invoices. Click Create key, and copy it: in live mode, Stripe shows it only once1,2.
- Ask your AI to connect Stripe. It declares the connection in while and gives you a link.
- Paste the restricted key into while. You open the link, paste the key and confirm. Neither your AI nor the tool’s code sees it.
Start with a test environment, with an rk_test_ key: payments are not actually processed there1. Switch to the live key once the tool is ready.
You, to your AI: Connect Stripe to this tool, read only, and show this week’s failed payments with the customer and the amount, so we can follow up.

What while does on each call
The tool calls Stripe through while, without a credential. while adds the restricted key to each call, and logs it in the history. For the first seven days, reads go through and teach while what the tool calls. A write, like creating a customer or a refund, goes through once you approve its rule. After that, an unexpected call is refused, and your AI is told.
For payments, caution makes sense. You can ask for your approval before a sensitive call.
You, to your AI: Ask me before every refund the tool makes in Stripe.
Each refund then waits for your approval in while before reaching Stripe. The credentials of your software are detailed on our security page, and the same mechanism works for any API in connect an API with no credentials in the code.
Changing the credential
Stripe lets you expire and roll a key from the API keys page, and advises changing it when someone who had access leaves the company1. When it changes, paste the new one into while: the tool uses it from the next call, without being put back in place.
What while adds around it
- Your colleagues use the tool with a while account for up to 3 people, or, on the Pro plan, with their email account, Google or Microsoft. See keep a tool for your colleagues.
- Connected software: one on the Libre plan, and 25 on the Pro plan, Stripe included.
- The tool’s data is backed up every day, and your tools are hosted in France by Nextmap.
To track incoming money, see the cash flow forecast, and for related connections, Qonto and Pennylane.
Try it with your tool
Give this message to your AI, then ask it to connect Stripe. The trial is free, with no sign-up, and your tool has its address in 3 minutes.
Read while.sh/agents and help me get started with while.
In the docs: Variables and secrets.
Sources
- Stripe, API keys, accessed November 18, 2026
- Stripe, Restricted API keys, accessed November 18, 2026