What is Stripe?
Stripe is a payment platform for:- One-time payments - Charge for products or services
- Subscriptions - Recurring billing
- Checkout - Pre-built payment pages
- Invoicing - Send and manage invoices
Getting Started
Use a Payment Template
The easiest way to add payments is starting with a template:- Create new app
- Choose SaaS Template or similar
- Stripe integration is pre-configured
- Connect your Stripe account
Add Payments to Existing App
Ask Kleap to add Stripe:Connecting Stripe
Create Stripe Account
- Go to stripe.com
- Sign up for an account
- Complete business verification
Get API Keys
- Go to Stripe Dashboard → Developers → API keys
- Copy your keys:
- Publishable key (
pk_test_...orpk_live_...) - Secret key (
sk_test_...orsk_live_...)
- Publishable key (
Add to Kleap
- Go to Settings > Environment
- Add variables:
Test vs Live Mode
| Mode | Keys | Use |
|---|---|---|
| Test | pk_test_, sk_test_ | Development, testing |
| Live | pk_live_, sk_live_ | Real payments |
Test Card Numbers
Use these in test mode:| Card Number | Result |
|---|---|
4242 4242 4242 4242 | Success |
4000 0000 0000 0002 | Declined |
4000 0000 0000 3220 | Requires 3D Secure |
Common Payment Flows
Stripe Checkout
Pre-built, hosted payment page:Subscription Management
Handle subscription lifecycle:Products and Prices
Create in Stripe Dashboard
- Go to Products → Add product
- Set name, description
- Add pricing (one-time or recurring)
- Copy the Price ID
Use Price ID in Code
Webhooks
Handle Stripe events in your app:Set Up Webhook
- In Stripe Dashboard → Webhooks → Add endpoint
- Enter your endpoint URL:
https://yourapp.com/api/stripe/webhook - Select events to listen for
- Copy the webhook signing secret
Handle Events
Important Events
| Event | When |
|---|---|
checkout.session.completed | Payment successful |
customer.subscription.created | New subscription |
customer.subscription.updated | Plan changed |
customer.subscription.deleted | Subscription canceled |
invoice.paid | Invoice payment successful |
invoice.payment_failed | Payment failed |
Pricing Strategies
One-Time Payment
Best for:- Digital products
- Templates
- Lifetime access
Monthly Subscription
Best for:- SaaS products
- Ongoing services
- Content access
Tiered Pricing
Going Live
Before accepting real payments:1
Complete Stripe verification
Verify your business identity in Stripe Dashboard
2
Switch to live keys
Replace test keys with live keys in environment variables
3
Test the flow
Make a real test purchase (refund afterward)
4
Set up webhooks for production
Create live webhook endpoint
Stripe Fees
| Type | Fee |
|---|---|
| Card payments | 2.9% + $0.30 |
| International | +1.5% |
| Currency conversion | +1% |
| Disputes | $15 |
Best Practices
Always use webhooks
Always use webhooks
Don’t rely on redirect success URLs alone. Webhooks ensure you capture all events.
Store customer IDs
Store customer IDs
Save Stripe customer IDs in your database to manage subscriptions.
Handle failed payments
Handle failed payments
Implement dunning emails and grace periods for failed subscription payments.
Test thoroughly
Test thoroughly
Test every payment flow in test mode before going live.
Troubleshooting
Webhook signature verification failed
Webhook signature verification failed
- Ensure you’re using the correct webhook secret
- Check the raw body isn’t being parsed before verification
- Verify the webhook URL matches exactly
Payment declined
Payment declined
- Check if using test cards in live mode (or vice versa)
- Verify the card details are correct
- Check for Radar (fraud) blocks in Stripe Dashboard
Subscription not updating
Subscription not updating
- Check webhook events are being received
- Verify your webhook handler processes the events
- Check database updates are working
SaaS Dashboard Tutorial
Build a complete SaaS with Stripe billing

