Overview
A Stripe connection in Flexprice stores encrypted credentials that allow the system to interact with your Stripe account for:- Creating customers in Stripe
- Processing payment links via Stripe Checkout
- Receiving webhook notifications from Stripe
- Synchronizing customer data between systems
Prerequisites
Before setting up your Stripe connection, ensure you have:- Active Stripe Account - Sign up at stripe.com
- API Keys - Available in your Stripe Dashboard
- Webhook Endpoint - Configured in Stripe Dashboard
- Flexprice Environment - Valid tenant and environment IDs
Step 1: Gather Stripe Credentials
Required Credentials
Credential | Location in Stripe Dashboard | Required | Purpose |
---|---|---|---|
Secret Key | Developers → API Keys | ✅ | Server-side API calls |
Webhook Secret | Developers → Webhooks → [Your Endpoint] | ✅ | Webhook signature verification |
Finding Your Credentials
-
API Keys:
- Go to Stripe Dashboard → Developers → API Keys
- Copy your
Secret key
(starts withsk_
) - Use test keys (
sk_test_
) for development
-
Webhook Secret:
- Go to Stripe Dashboard → Developers → Webhooks
- Create or select your webhook endpoint
- Click “Reveal signing secret”
- Copy the secret (starts with
whsec_
)
Step 2: Configure Webhook Endpoint in Stripe
Webhook URL Format
Required Webhook Events
Configure these events in your Stripe webhook endpoint:Event Type | Purpose |
---|---|
checkout.session * | Track payment link completions from Stripe Checkout |
customer * | Synchronize customer data changes between Stripe and Flexprice |
payment_intent * | Monitor payment processing status and handle payment lifecycle events |
Setting Up the Webhook
- Go to Stripe Dashboard → Developers → Webhooks
- Click + Add endpoint
- Enter your webhook URL
- Select the required events listed above
- Click Add endpoint
- Copy the Signing secret for your connection
Step 3: Create Stripe Connection via API
Using Flexprice Dashboard
You can create a Stripe connection directly from the Flexprice dashboard:
API Request
Endpoint:POST /api/v1/connections
Headers:
Response
Security Best Practices
Credential Management
- Environment Separation: Use different keys for test/production
- Key Rotation: Regularly rotate your Stripe API keys
- Access Control: Limit API key permissions in Stripe
- Encryption: All credentials are encrypted at rest in Flexprice
Webhook Security
- HTTPS Only: Always use HTTPS for webhook endpoints
- Signature Verification: Flexprice verifies all webhook signatures
- Secret Management: Keep webhook secrets secure and rotate regularly
- Rate Limiting: Implement rate limiting on webhook endpoints
Troubleshooting
Common Issues
Issue | Cause | Solution |
---|---|---|
Connection test fails | Invalid API keys | Verify keys in Stripe Dashboard |
Webhook not received | Incorrect webhook URL | Check URL format and endpoint |
Signature verification fails | Wrong webhook secret | Update webhook secret in connection |
Customer sync fails | Missing account permissions | Check Stripe account permissions |
Debug Steps
- Check Stripe Dashboard: Verify API keys and webhook configuration
- Test API Keys: Use Stripe CLI to test API key validity
- Monitor Webhooks: Check webhook delivery logs in Stripe
- Review Logs: Check Flexprice application logs for errors
Next Steps
After setting up your Stripe connection:- Test Customer Sync: Create a test customer and sync to Stripe
- Create Payment Links: Test payment link creation and flow
- Monitor Webhooks: Ensure webhook events are being received
- Go Live: Switch to production keys when ready