Stripe Integration Guide
Complete guide to integrate Stripe payment system with your store
Stripe Payment Integration
Complete guide to integrate Stripe Checkout for processing payments in your store system.
Stripe is a leading payment processor supporting credit cards, digital wallets, and local payment methods in 135+ currencies.
Prerequisites
Before you begin, ensure you have:
- ✅ A Stripe account (Sign up here)
- ✅ Admin access to your dashboard
- ✅ Backend server running
- ✅ SSL certificate (HTTPS required for production)
Overview
The Stripe integration uses Checkout Sessions:
- Products are managed in your database
- Checkout sessions created via Stripe API
- Payments processed by Stripe
- Webhooks notify your system of completed payments
Architecture
[Admin Panel] → [Your Database] → [Stripe Checkout] → [Stripe Webhooks] → [Your Backend]Important: Unlike Tebex, Stripe products are managed directly in your admin panel, not in Stripe Dashboard!
Step 1: Get Stripe Credentials
Create Stripe Account
- Go to Stripe Dashboard
- Click "Sign Up"
- Complete registration
- Verify your email
Complete Business Profile
- Dashboard → Settings
- Fill in business details
- Add bank account (for production)
- Complete verification
Get API Keys (Test Mode)
- Ensure "Test mode" is ON (toggle at top)
- Navigate to Developers → API Keys
- You'll see two keys:
Publishable Key
pk_test_51xxxxxxxxxxxxxxxxxxxxx- Safe to use client-side
- Used for Stripe UI components
- Can be public
Secret Key
sk_test_51xxxxxxxxxxxxxxxxxxxxx- NEVER expose client-side!
- Used for backend operations
- Keep secure
Security Warning: Never commit secret keys to public repositories!
Step 2: Configure Webhook
Webhooks are essential for payment notifications.
Create Webhook Endpoint
- Dashboard → Developers → Webhooks
- Click "Add endpoint"
- Enter details:
Endpoint URL
https://yourdomain.com/api/store/webhook/{providerId}You'll get the providerId after creating the Stripe provider in your admin panel.
Select Events
Choose ONLY these events:
✅ Required Events:
checkout.session.completed ← PRIMARY EVENT
checkout.session.expired
checkout.session.async_payment_succeeded
checkout.session.async_payment_failed
charge.refunded
charge.dispute.created
charge.dispute.updated
charge.dispute.closed❌ DO NOT SELECT (Creates duplicates):
payment_intent.succeeded ← Duplicate of checkout.session
payment_intent.payment_failed ← Duplicate
payment_intent.canceled ← Duplicate
charge.succeeded ← Duplicate
charge.failed ← DuplicateImportant: Each payment triggers multiple events. We only process checkout.session.* to avoid duplicate transactions!
Get Webhook Secret
- Click on the created webhook
- Find "Signing secret" section
- Click "Reveal"
- Copy the secret (format:
whsec_xxxxxxxxxxxxx)
Step 3: Configure Provider in Admin Panel
Add Stripe Provider
- Login to your Admin Panel
- Navigate to Store → Settings
- Click "Add Provider"
- Select "Stripe" as provider type
Enter Credentials
Fill in the form:
| Field | Value | Example |
|---|---|---|
| Name | Provider name | Stripe Checkout |
| Public Key | Publishable key | pk_test_51xxxxx |
| Secret Key | Secret key | sk_test_51xxxxx |
| Webhook Secret | From Step 2 | whsec_xxxxxx |
| Currency | Default currency | USD, EUR, TRY, etc. |
| Active | Enable provider | ✅ Checked |
Currency: This sets the default currency for all products. You can change it per product later.
Save and Get Provider ID
- Click "Save"
- Copy the Provider ID from the list
- It looks like:
07baa137-3833-4534-832c-0c920961f82f
Update Webhook URL
- Go back to Stripe Dashboard → Webhooks
- Edit your webhook
- Update URL with actual Provider ID:
https://yourdomain.com/api/store/webhook/07baa137-3833-4534-832c-0c920961f82f - Save changes
Step 4: Create Products
Unlike Tebex, Stripe products are managed in your admin panel.
Navigate to Packages
- Admin Panel → Store → Packages
- Click "New Package"
Fill Product Details
Basic Information
- Name: Product name (e.g., "VIP Rank")
- Description: Use rich text editor for detailed description
- Price: Product price (e.g.,
9.99) - Currency: Select currency (defaults to provider currency)
Product Image
- Click "Upload Image" in the sidebar
- Select image (max 5MB)
- Image is uploaded to your CDN
- Preview appears automatically
Images are stored in your system using the upload service, not in Stripe.
Stock Management
- Leave empty for unlimited stock
- Enter number for limited stock (e.g.,
100)
Status
- ✅ Active: Visible in shop
- ❌ Inactive: Hidden from customers
Actions (Work in Progress)
Optional JSON for future automation:
{
"commands": ["give {player} diamond 64"],
"permissions": ["vip.access"],
"discord_roles": ["role-id-123"]
}Actions feature is in development. You can add them now for future use.
Save Product
Click "Save" to create the product.
Step 5: Test the Integration
Test in Shop
- Navigate to your shop page
- Verify products are visible
- Check prices and images display correctly
Test Checkout Flow
- Add a product to basket
- Click "Checkout"
- Should redirect to Stripe Checkout
Complete Test Payment
Use Stripe test cards:
Successful Payment
Card: 4242 4242 4242 4242
Date: 12/25 (any future date)
CVC: 123 (any 3 digits)Failed Payment
Card: 4000 0000 0000 0002
(Card will be declined)3D Secure
Card: 4000 0027 6000 3184
(Requires authentication)Verify Webhook Delivery
-
Complete test payment
-
Check backend logs:
📨 [Stripe] Webhook işleniyor: checkout.session.completed ✅ [Stripe] Transaction oluşturuldu: cs_test_xxxxx 💾 Transaction veritabanına kaydediliyor... ✅ Transaction kaydedildi -
Check Stripe Dashboard → Webhooks → Logs
-
All webhooks should show ✅
Verify Transaction
- Admin Panel → Store → Transactions
- Your test payment should appear
- Status should be "Completed"
- Amount should be correct
Production Setup
Switch to Live Mode
- Stripe Dashboard → Toggle "Test mode" OFF
- Now you're in Live mode
Get Live API Keys
- Developers → API Keys (in live mode)
- Copy live keys:
- Publishable:
pk_live_xxxxx - Secret:
sk_live_xxxxx
- Publishable:
Create Live Webhook
- Developers → Webhooks → Add endpoint
- Same URL:
https://yourdomain.com/api/store/webhook/{providerId} - Select same events as before
- Get live webhook secret:
whsec_xxxxx
Create Production Provider
- Admin Panel → Store → Settings
- Deactivate test provider
- Create new provider with live keys:
- Public Key:
pk_live_xxxxx - Secret Key:
sk_live_xxxxx - Webhook Secret:
whsec_xxxxx(live) - Currency: Your currency
- Active: ✅
- Public Key:
Update Webhook URL
Update Stripe webhook with new production provider ID.
Test with Real Payment
- Make a small real purchase ($0.50-$1.00)
- Verify everything works
- Refund the test transaction
HTTPS Required: Production webhooks require SSL/HTTPS. Ensure your domain has a valid certificate!
Webhook Signature Verification
Your backend automatically verifies webhooks using Stripe SDK.
How It Works
// Backend verifies each webhook
const stripe = new Stripe(secretKey);
const event = stripe.webhooks.constructEvent(
rawBody,
signature,
webhookSecret
);
if (!event) {
return 403; // Invalid signature
}Security Features
✅ Signature verification using Stripe SDK ✅ Timestamp validation (prevents replay attacks) ✅ HTTPS enforcement in production ✅ Raw body preservation for verification
Troubleshooting
Products Not Showing
Problem: Shop page is empty
Solutions:
- Check products are Active in admin panel
- Verify Stripe provider is Active
- Check backend logs for errors
- Ensure products have valid prices
Invalid Signature Error
Problem: Webhooks return "Invalid signature"
Solutions:
- Verify webhook secret in admin panel matches Stripe
- Check you're using the correct environment (test vs live)
- Ensure raw body is preserved (don't parse before verification)
- Verify webhook URL has correct provider ID
Webhook Not Received
Problem: Payment successful but no transaction recorded
Solutions:
- Check webhook URL is correct
- Verify webhook events are selected in Stripe
- Check backend logs:
/api/store/webhook/{providerId} - Test webhook in Stripe Dashboard → Send test webhook
Session ID Not Found
Problem: Success page shows "Payment processing"
Solutions:
- Wait a few seconds (webhook might be delayed)
- Refresh the page
- Check backend received the webhook
- Verify transaction was created with session ID
Currency Mismatch
Problem: Prices showing wrong currency
Solutions:
- Update provider currency setting
- Edit existing products to use new currency
- Create new products (they'll use provider currency)
Production Checklist
Before going live:
- Live API keys configured
- Live webhook created and tested
- All products configured with correct prices
- Test purchase with real payment completed
- HTTPS/SSL certificate active
- Webhook signature verification working
- Transaction appears in admin panel
- Success page displays correctly
- Email notifications working (if configured)
- Stripe Dashboard notifications enabled
Supported Payment Methods
Stripe supports 40+ payment methods:
Cards
- ✅ Visa
- ✅ Mastercard
- ✅ American Express
- ✅ Discover
Digital Wallets
- ✅ Apple Pay
- ✅ Google Pay
- ✅ Link
Local Methods (Region-specific)
- 🇪🇺 SEPA Direct Debit
- 🇳🇱 iDEAL
- 🇵🇱 Przelewy24
- 🇹🇷 Turkish Local Cards
- And many more...
Payment methods are automatically shown based on customer location and currency.
Supported Currencies
Stripe supports 135+ currencies including:
| Currency | Code | Symbol |
|---|---|---|
| US Dollar | USD | $ |
| Euro | EUR | € |
| British Pound | GBP | £ |
| Turkish Lira | TRY | ₺ |
| Japanese Yen | JPY | ¥ |
| Canadian Dollar | CAD | $ |
| Australian Dollar | AUD | $ |
| Swiss Franc | CHF | Fr |
| Chinese Yuan | CNY | ¥ |
| Indian Rupee | INR | ₹ |
API Reference
Checkout Session Creation
// Your backend creates sessions
const session = await stripe.checkout.sessions.create({
mode: 'payment',
line_items: [{
price_data: {
currency: 'usd',
product_data: {
name: 'VIP Rank',
},
unit_amount: 999, // $9.99 in cents
},
quantity: 1,
}],
success_url: 'https://yourdomain.com/shop/success?session_id={CHECKOUT_SESSION_ID}',
cancel_url: 'https://yourdomain.com/shop',
metadata: {
userId: 'user-123',
basketId: 'basket-456',
},
});Webhook Event Structure
{
"id": "evt_xxxxxx",
"type": "checkout.session.completed",
"data": {
"object": {
"id": "cs_test_xxxxxx",
"amount_total": 999,
"currency": "usd",
"customer_details": {
"email": "[email protected]",
"name": "John Doe"
},
"payment_intent": "pi_xxxxxx",
"payment_status": "paid",
"metadata": {
"userId": "user-123",
"basketId": "basket-456"
}
}
}
}Environment Variables
Backend .env configuration:
# Required
BETTER_AUTH_URL=https://yourdomain.com
NODE_ENV=production
# Optional (for development)
SKIP_WEBHOOK_IP_CHECK=true # If using CloudflareBest Practices
Product Management
✅ Do:
- Use clear, descriptive product names
- Add detailed descriptions with rich text
- Upload high-quality images (512x512px recommended)
- Set appropriate prices for your market
- Organize products logically
- Use stock limits for limited items
❌ Don't:
- Use confusing abbreviations
- Leave descriptions empty
- Skip product images
- Set incorrect prices
- Mix unrelated products
Security
✅ Do:
- Always verify webhook signatures
- Use HTTPS in production
- Keep secret keys secure
- Rotate keys periodically
- Monitor failed webhooks
- Enable Stripe Radar (fraud detection)
❌ Don't:
- Commit secrets to git
- Use HTTP in production
- Skip signature verification
- Share secret keys
- Ignore webhook failures
Testing
✅ Do:
- Test thoroughly in test mode
- Try different payment methods
- Test failed payments
- Verify webhook delivery
- Check all transaction states
- Test success/cancel flows
❌ Don't:
- Skip test mode
- Test with real money initially
- Ignore webhook tests
- Deploy without testing
Customer Experience
✅ Do:
- Use clear product descriptions
- Show prices in customer's currency
- Provide email receipts
- Display order confirmation
- Handle errors gracefully
❌ Don't:
- Hide pricing
- Use confusing checkout flow
- Skip confirmation pages
- Ignore payment failures
Monitoring & Analytics
Stripe Dashboard
Monitor your store performance:
- Home: Overview of recent activity
- Payments: All payment transactions
- Customers: Customer database
- Analytics: Revenue reports
Your Admin Panel
Track transactions:
- Store → Overview: Sales statistics
- Store → Transactions: Detailed transaction list
- Store → Packages: Product performance
Key Metrics
Monitor these important metrics:
- 📊 Conversion Rate: Checkout starts vs completions
- 💰 Revenue: Daily/weekly/monthly sales
- 🔄 Refund Rate: Percentage of refunded transactions
- ⚠️ Dispute Rate: Chargebacks and disputes
- ✅ Success Rate: Successful vs failed payments
Advanced Features
Customer Portal (Future)
Allow customers to:
- View purchase history
- Download receipts
- Request refunds
- Manage subscriptions
Recurring Payments (Future)
Enable subscription products:
- Monthly/yearly billing
- Automatic renewals
- Trial periods
- Tiered pricing
Actions Automation (Work in Progress)
When actions feature is complete:
- Automatic command execution
- Role assignments
- Discord integrations
- Email notifications
Migration Guide
From Tebex to Stripe
-
Export Data:
- Export product list from Tebex
- Save product images
- Note product configurations
-
Recreate Products:
- Create each product in admin panel
- Upload images
- Set same prices
- Configure actions
-
Test:
- Run parallel for 1 week
- Compare transaction volumes
- Verify all features work
-
Switch:
- Disable Tebex provider
- Enable Stripe provider
- Announce to customers
From Other Providers
Similar process:
- Document current setup
- Recreate in admin panel
- Test thoroughly
- Gradual migration
Support Resources
- 📚 Stripe Documentation
- 💬 Stripe Discord
- 🎫 Support Center
- 📧 Email: [email protected]
- 📞 Phone: Available for verified businesses
FAQ
Why aren't products in Stripe Dashboard?
Our integration manages products in your database, not Stripe. This gives you more flexibility and faster updates.
Can I use both Tebex and Stripe?
Yes! You can have multiple providers active. Customers choose at checkout.
What about taxes?
Stripe Tax is available in select regions. Configure in Stripe Dashboard → Settings → Tax.
Are subscriptions supported?
Coming soon! The actions field will support recurring payments.
How do refunds work?
Refunds are processed through Stripe Dashboard. Webhooks will update your system automatically.
Next Steps
After successful integration:
- ✅ Configure email notifications
- ✅ Set up product categories
- ✅ Create promotional campaigns
- ✅ Monitor analytics regularly
- ✅ Optimize product offerings
Congratulations! Your Stripe integration is complete. You can now accept payments globally with 135+ currencies! 🎉
Need help? Check our Troubleshooting Guide or Contact Support.