Connect Stripe to n8n?
You can connect Stripe to n8n by creating a Stripe API key and adding it as credentials in your n8n instance, then using the Stripe node in a workflow.
What You Need
- A Stripe account and secret API key.
- A machine with Docker and docker-compose.
- n8n running in Docker with a public URL or webhook forwarding tool (Stripe CLI or ngrok).
- Basic familiarity with n8n workflows and nodes.
How to Connect Stripe to n8n
This section shows how to run n8n in Docker, add Stripe credentials, and trigger a simple workflow.
Step 1: Run n8n with docker-compose
Create a docker-compose.yml file and start n8n.
version: '3.1'
services:
n8n:
image: n8nio/n8n:latest
restart: always
ports:
- 5678:5678
environment:
- GENERIC_TIMEZONE=UTC
- N8N_BASIC_AUTH_ACTIVE=true
- N8N_BASIC_AUTH_USER=admin
- N8N_BASIC_AUTH_PASSWORD=strongpassword
volumes:
- ./n8n:/home/node/.n8n
docker-compose up -d
docker-compose logs -f n8n
Step 2: Create a Stripe API key
Sign in to the Stripe Dashboard. Go to Developers › API keys. Create or copy a secret key (starts with sk_test_ or sk_live_).
Step 3: Add Stripe credentials in n8n
Open your n8n UI at http://localhost:5678. Log in with the basic auth user. Create a new credential for Stripe and paste the secret key.
In n8n use the Stripe node and choose the credential you created. For events, use the Stripe Trigger node or the Stripe node in webhook mode.
Step 4: Test webhooks locally
If you run n8n locally, use the Stripe CLI to forward events to your local webhook URL. Install the Stripe CLI first.
stripe login
stripe listen --forward-to http://localhost:5678/webhook/stripe
Trigger a test event from the Stripe CLI or the Dashboard. In n8n, create a workflow that starts with a Webhook or Stripe Trigger node to capture the event.
Step 5: Build a simple workflow
Create a new workflow in n8n. Add a Stripe node set to “Retrieve Charge” or a Webhook node to receive events. Link it to a subsequent node like an HTTP Request or a Function node to process the data.
// Example logic steps (conceptual)
1. Webhook node receives stripe event.
2. Function node extracts customer and amount.
3. HTTP Request node posts data to your service.
Update
To update n8n, pull the latest image and restart the container. Keep your workflows backed up before upgrading.
docker pull n8nio/n8n:latest
docker-compose down
docker-compose up -d
If you use persistent volumes, your workflows remain intact. Check the n8n changelog for breaking changes before major upgrades.
Security
- Never hard-code your Stripe secret in public repos or logs.
- Store keys as n8n credentials or environment variables with restricted access.
- Protect n8n with TLS and basic auth, or put it behind a VPN or reverse proxy.
- Verify webhook signatures using the Stripe signing secret when possible.
- Rotate API keys regularly and grant minimal permissions for integration keys.
Done
You now have a working connection between Stripe and n8n. Use the Stripe node to automate receipts, billing events, and customer actions.
For production, deploy n8n on a secure host, enable HTTPS, and use a stable domain for webhooks.