Skip to content

Connect Stripe, Brevo or any API to your app with no credential in the code (2026)

An API key in the code always ends up leaking: in a repository, a log, a conversation with your AI. With while, your app calls Stripe or Brevo without ever holding the key, and every call is recorded.

By Aloïs Oddon, co-founder of Nextmap. Facts checked on November 19, 2026.

View as Markdown

Connect Stripe, Brevo or any API to your app with no credential in the code: an API such as Stripe or Brevo with Claude Code, Cursor or Codex, on while, hosted in France

The short version. Your AI connects Stripe, Brevo or any API to your app over MCP. The key stays in while: neither your code nor your AI ever sees it. What matters, like deleting a database, waits for a person’s approval.

Prerequisites

  • An app, already on while or ready to deploy.
  • The key for the API you want to connect, from Stripe or Brevo for example.
  • An AI that works in a terminal: Claude Code, Codex, Cursor or Gemini CLI.

Step 1: Give your AI this message

Open your AI in your app’s folder and paste this message into it:

The message to give your AI
Connect to while with my account (while.sh/agents), then put my app on while.

Your AI adds while’s MCP server itself. If it asks you to, restart it. On the first call to while, a page opens in your browser. In Claude Code, if it doesn’t open, type /mcp, choose while, then Authenticate. On that page, choose “A new app”, then click Authorize.

Step 2: Paste the key into while

Your AI declares the connection to Stripe and gives you a link. You open it, paste the Stripe key and approve. Your AI never sees it1.

What your AI does

It adds the connection to the service, in while.yaml:

while.yaml
services:
  - name: web
    port: 3000
    connections: [stripe]

Your app receives while’s address for Stripe in STRIPE_URL, and calls it without a key:

server.js
const r = await fetch(`${process.env.STRIPE_URL}/v1/balance`);
const solde = await r.json();

The key is added to every call, and every call is recorded. For the first 7 days, reads go through, and while learns from them what your app calls. A write, like a payment or an outgoing email, goes through as soon as you approve its rule. After that, an unexpected call is refused, and your AI is notified.

An API such as Stripe or Brevo with while: credentials kept out of the AI's reach, every call logged in the history, a person's approval for what matters and a daily backup, in France
Around every app, while keeps the credentials, the history, the approvals and the backups.

Allow a new call

You, to your AI: Allow creating customers in Stripe.

Your AI proposes the rule, and you approve it in while. Your app then creates its customers, and anything you haven’t allowed is still refused.

Ask for your approval before a sensitive call

You, to your AI: Ask me before every refund.

Your AI sets a rule on refunds: each one waits for your approval in while before it goes out to Stripe.

Change the key

You, to your AI: We need to change the Brevo key.

You paste the new key into while, and your app uses it from the very next call, with no new deployment.

See your app’s calls

You, to your AI: Why did sending emails fail yesterday?

Your AI reads the latest call and the refused calls on the Brevo connection in while, and fixes the problem.

Connect Google with no key to keep

You, to your AI: Connect Google Sheets to our app.

Your AI declares the connection to Google. Depending on what you choose, a service account’s key stays in while, or there is no key at all: short-lived tokens, signed for your app, that Google exchanges.

Go back to the previous version

You, to your AI: Go back to the previous version.

In the 30 minutes after a production release, the previous version comes back in a second. After that, it takes a few seconds. Once the previous version is back, your AI reads what broke in while’s logs, fixes it and deploys again.

In the docs: Outbound traffic, API connections and Versions and rollback.

Next steps

Sources

  1. Stripe, keeping your API keys safe, accessed November 2, 2026

Questions

Can my AI see the key?

No. You enter it in while, never in your AI or in your code, and it is added to every call.

Do I need to change my code?

Hardly: your app calls the address it receives in STRIPE_URL instead of Stripe’s, and stops sending a key.

Which APIs work?

Any HTTP API: a key in a header or in the URL, Basic, Bearer, OAuth2, or a signed token, as with Google, Salesforce or Microsoft.

What if my app is hacked?

The key isn’t in it, so it doesn’t leak with the code. And nothing goes through beyond the calls your app usually makes.

How many APIs can I connect?

One API with a key on the Free plan, and 25 on the Pro plan.

Give your AI the message, and it takes care of the rest

Give this to your AI

Read while.sh/agents and help me get started with while.

Copy the message

In 3 minutes, with no sign-up, the tool has its own address. To keep it, create your account.

For a company project, write to the while team: hello@while.sh