How to Get Stripe API Keys & Client Connect Key (Complete Guide)
If you're building a payment-enabled application using Stripe, you’ll need to generate API keys and (in some cases) connect your users’ Stripe accounts.
This guide covers everything:
- Stripe API Keys (Publishable & Secret)
- Test Mode vs Live Mode
- Connect API (Client ID / Connect Keys)
- Merchant account types
- Payout configurations
What You’ll Learn
- How to generate Stripe API keys (test & live)
- Difference between publishable and secret keys
- How to get Stripe Connect client ID
- Stripe account types explained
- Payout and webhook basics
Quick Navigation
1. What Are Stripe API Keys?
Stripe uses API keys to authenticate your application when making requests.
There are 2 main types:
🔹 Publishable Key (pk_...)
- Used in frontend (JavaScript, mobile apps)
- Safe to expose publicly
- Used for creating tokens, payment methods
🔹 Secret Key (sk_...)
- Used in backend (server-side)
- Must be kept strictly private
- Used to create charges, customers, subscriptions
2. Test Mode vs Live Mode
Stripe provides two environments:
🧪 Test Mode
- Used for development & testing
- No real money involved
- Uses test cards (like " 4242 4242 4242 4242 ")
💰 Live Mode
- Real transactions
- Real customers & payouts
👉 Important:
Each mode has separate API keys
3. How to Get Stripe API Keys
Step-by-Step:
- Go to: https://dashboard.stripe.com/
- Log in to your account
- Toggle "Test Mode" ON (top right) # (New accounts usually open in Test Mode by default)
- Navigate to: 👉 Developers → API Keys
You will see:
- Publishable Key →
pk_test_... - Secret Key →
sk_test_...
Click "Reveal test key" to view secret key
🔁 Switching to Live Keys
- Turn OFF "Test Mode."
- Same section → Developers → API Keys
- Now you’ll see:
pk_live_...sk_live_...
4. Important Security Best Practices
- Never expose The Secret Key in the frontend.
-
Store keys in:
-
.envfiles - Server environment variables
-
Rotate keys periodically
Use restricted keys if needed
5. What is Stripe Connect?
Stripe Connect allows you to:
- Accept payments on behalf of other users
- Split payments
- Send payouts to vendors
👉 Example:
- Marketplace (like Uber or Amazon)
- SaaS platforms
- Multi-vendor systems
6. Types of Stripe Connect Accounts
Stripe provides 3 types of connected accounts:
🔹 Standard Account
- User signs up directly on Stripe
- Full Stripe dashboard access
- Stripe handles compliance
👉 Best for: simple integrations
🔹 Express Account
- Stripe-hosted onboarding
- Limited dashboard access
- You control UX partially
👉 Best for: platforms needing balance control + easy onboarding
🔹 Custom Account
- Full control over UX
- You handle onboarding, KYC, compliance
👉 Best for: large platforms with full control requirements
7. How to Get Stripe Connect Client ID (Client Connect Key)
This is required for OAuth-based connections.
Steps:
Go to Stripe Dashboard
Navigate to:
👉 Settings → Connect SettingsEnable OAuth for Standard accounts
You will find:
-
Client ID →
ca_...
👉 This is your Client Connect Key
8. How Stripe OAuth Flow Works (Simplified)
User → Your App → Stripe OAuth → Approval → Redirect → Access Token
- Redirect user to Stripe OAuth URL:
https://connect.stripe.com/oauth/authorize
- Pass:
client_idscoperedirect_uri
User logs in & approves
Stripe redirects back with:
- Authorization Code
- Exchange code → Access Token
9. Payout Modes in Stripe
Stripe supports multiple payout methods:
🔹 Automatic Payouts
- Funds automatically sent to bank
- Daily / weekly / monthly
🔹 Manual Payouts
- You trigger payouts via API
🔹 Instant Payouts
- Funds sent instantly (fees apply)
- Requires debit card
10. Merchant Types & Flow
Depending on your use case:
| Use Case | Recommended Setup |
|---|---|
| Single business | Normal Stripe account |
| SaaS platform | Stripe Connect (Express) |
| Marketplace | Stripe Connect (Custom/Express) |
| Freelancer platform | Connect + split payments |
11. Common Mistakes to Avoid
❌ Using test keys in production
❌ Exposing secret key in frontend
❌ Not handling webhooks properly
❌ Not verifying payouts & account status
12. Bonus: Webhooks (Must Have)
Stripe uses webhooks to notify your server about events:
Examples:
- Payment success
- Payment failed
- Subscription updates
👉 Setup:
Developers → Webhooks → Add endpoint
13. Final Notes
- Always test in Test Mode first
- Switch to Live only after full validation
- Use logging for debugging payments
- Keep keys secure
14. Test Cards for Stripe (Quick Reference)
Use these cards in Test Mode:
- Successful payment: 4242 4242 4242 4242
- Requires authentication: 4000 0025 0000 3155
- Payment fails: 4000 0000 0000 9995
👉 Use any future expiry date and random CVC.
🔚 Conclusion
Getting Stripe API keys and Connect setup is simple once you understand the structure.
- API Keys → Authentication
- Test vs Live → Environment separation
- Connect → Multi-user payment handling
🚀 Need Help with Stripe Integration?
We help businesses build secure and scalable payment systems using Stripe.
✔ SaaS & subscription billing
✔ Marketplace & split payments
✔ Custom Stripe Connect integrations
👉 Contact us to get your Stripe integration done professionally.






Top comments (0)