Payment Architecture Overview
The payment system follows a secure, project-scoped design where each project maintains its own Stripe configuration:Key Design Principles
Project-Scoped Credentials
Each project stores its own Stripe API keys separately, enabling different Stripe accounts per project or shared accounts with proper isolation.
Test/Live Mode Separation
Maintain separate credentials for test and live environments, with mode-specific webhook endpoints for proper event routing.
Encrypted Storage
All Stripe credentials are encrypted at rest in the Cloud API database—never exposed in logs or API responses.
Webhook Verification
All incoming webhooks are verified using Stripe’s signature verification to prevent spoofed events.
Prerequisites
Before configuring payments, ensure you have:Active Stripe Account
Create a Stripe account if you don’t have one. You can use the same account for multiple projects or create separate accounts per project.
Dev Kit Project
A project created in Cloud Admin with at least one API key.
Stripe Products & Prices
Create your subscription products and prices in the Stripe Dashboard. Note the Price IDs (e.g.,
price_1234...) for use in checkout sessions.Obtaining Stripe Credentials
API Keys
Navigate to the Stripe API Keys page to find your credentials:- Test Mode
- Live Mode
Test mode keys are prefixed with
sk_test_ and pk_test_. Use these during development and testing.- Secret Key (
sk_test_...orsk_live_...) — Used server-side for API calls. Never expose this in client code. - Publishable Key (
pk_test_...orpk_live_...) — Used client-side for Stripe.js (optional, if implementing custom checkout UI).
Webhook Signing Secret
Webhook secrets are generated when you create a webhook endpoint in Stripe. You’ll get these from Cloud Admin after configuring your project (the webhook URLs are provided automatically).Configuring Payments in Cloud Admin
Step 1: Navigate to Project Payments
Open your project in Cloud Admin and navigate to the Payments tab: (((REPLACE_THIS_WITH_IMAGE: console-project-payments-tab-overview.png: Cloud Admin project payments tab showing configuration options and empty state)))Step 2: Add Stripe Credentials
Click Configure Payments to open the configuration form: (((REPLACE_THIS_WITH_IMAGE: console-payment-config-form.png: Payment configuration form with fields for Stripe API keys and webhook secrets)))Select Mode
Choose Test Mode initially to safely test your integration without processing real payments.
Enter Secret Key
Paste your Stripe Secret Key (
sk_test_... for test mode). This is used for all server-side Stripe operations.Validate Credentials
Click Validate to verify your API key works. The system makes a test API call to Stripe to confirm validity.
Step 3: Configure Webhook Endpoints
After saving your Stripe configuration, Cloud Admin displays your webhook URLs:Alternative domain:
https://api.vibecoding.ad/api/v1/payments/stripe/webhooks/{project_id}/{mode}Open Stripe Webhooks
Navigate to Stripe Webhooks and click Add endpoint.
Select Events
Choose the events to listen for. Recommended events:
checkout.session.completedcustomer.subscription.createdcustomer.subscription.updatedcustomer.subscription.deletedinvoice.paidinvoice.payment_failedcharge.refunded
Credential Validation
The Cloud API provides automatic credential validation to ensure your Stripe configuration is correct before going live:Validation Checks
The validation endpoint performs these checks:| Check | Description |
|---|---|
| API Key Format | Verifies the key matches Stripe key format (sk_test_* or sk_live_*) |
| Authentication | Confirms the key authenticates successfully with Stripe |
| Permissions | Verifies the key has necessary permissions for payment operations |
Local Development with Stripe CLI
For local development and testing, use the Stripe CLI to forward webhook events to your local environment:Install Stripe CLI
- macOS
- Linux
- Windows
Login and Forward Webhooks
Replace
{project_id} with your actual project UUID from Cloud Admin. Alternative API domain: https://api.vibecoding.ad/...whsec_...). Use this temporary secret in your local development environment, or configure it in Cloud Admin for testing.
Trigger Test Events
Security Best Practices
Never Expose Secret Keys
Never Expose Secret Keys
Stripe secret keys (
sk_*) should only be stored in Cloud Admin and used server-side. Never include them in:- Client-side JavaScript
- Mobile app code
- Git repositories
- Logs or error messages
Use Test Mode for Development
Use Test Mode for Development
Always use test mode (
sk_test_*) during development. Switch to live mode only after thorough testing. Test mode:- Processes simulated transactions
- Uses test card numbers
- Generates test webhook events
Verify Webhook Signatures
Verify Webhook Signatures
Cloud API automatically verifies all incoming webhooks using the signing secret. This prevents:
- Replay attacks
- Spoofed events
- Unauthorized subscription modifications
Rotate Credentials Regularly
Rotate Credentials Regularly
Periodically rotate your Stripe API keys and webhook secrets, especially if you suspect compromise. Update them in Cloud Admin immediately.
Configuration API Reference
For programmatic configuration, Cloud Admin uses these Cloud API endpoints:Get Configuration
Retrieve current Stripe configuration status for a project
Update Configuration
Create or update Stripe credentials for a project
Delete Configuration
Deactivate Stripe configuration for a project
Get Webhook URLs
Get the webhook endpoint URLs for Stripe dashboard
Validate Credentials
Test Stripe API credentials before saving
Switching to Live Mode
When you’re ready to accept real payments:Complete Test Mode Verification
Ensure all payment flows work correctly in test mode:
- New subscriptions
- Plan changes (upgrade/downgrade)
- Cancellations
- Webhook events processing
Add Live Credentials
In Cloud Admin, switch to Live Mode and add your live Stripe API key (
sk_live_...).Configure Live Webhook
Create a new webhook endpoint in Stripe for your live mode URL and add the signing secret to Cloud Admin.
Next Steps
Subscription Management
Learn about the complete subscription lifecycle and billing workflows
Monitor Payments
View subscriptions and transactions in Cloud Admin
End-User Billing
Implement billing UI components in your Starter Kit application
Payments API Reference
Complete API documentation for all payment endpoints

