Documentation Index Fetch the complete documentation index at: https://devkit4ai.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
The Payments API enables developers to integrate Stripe-powered payment processing into their projects. This includes subscription management, one-time payments, customer portals, and comprehensive payment analytics.
Architecture Overview
The payment system is designed with a multi-tenant architecture where each project can have its own Stripe configuration:
API Groups
Payments (Aggregated)
Cross-project payment data for developers to view all subscriptions and transactions across their projects.
Endpoint Method Description /api/v1/payments/subscriptionsGET List all subscriptions across projects /api/v1/payments/transactionsGET List all payment transactions across projects /api/v1/payments/projectsGET List projects with payment configuration status /api/v1/payments/statsGET Get aggregated payment statistics
Stripe Configuration
Developer-facing endpoints for configuring Stripe credentials per project.
Endpoint Method Description /api/v1/payments/stripe/projects/{project_id}/configGET Get Stripe configuration /api/v1/payments/stripe/projects/{project_id}/configPUT Create or update Stripe configuration /api/v1/payments/stripe/projects/{project_id}/configDELETE Deactivate Stripe configuration /api/v1/payments/stripe/projects/{project_id}/webhook-urlsGET Get webhook URLs for Stripe dashboard /api/v1/payments/stripe/projects/{project_id}/validate-credentialsPOST Validate Stripe API credentials /api/v1/payments/stripe/projects/{project_id}/subscriptionsGET List project subscriptions /api/v1/payments/stripe/projects/{project_id}/paymentsGET List project payment transactions
Stripe Checkout
Create Stripe checkout sessions for subscription or one-time payments.
Endpoint Method Description /api/v1/payments/stripe/checkout-sessionPOST Create checkout session
Stripe Webhooks
Receive and process webhook events from Stripe.
Endpoint Method Description /api/v1/payments/stripe/webhooks/{project_id}/{mode}POST Handle Stripe webhook events
Stripe Subscriptions (End User)
End-user facing endpoints for managing their own subscriptions.
Endpoint Method Description /api/v1/payments/stripe/my-subscriptionGET Get current subscription /api/v1/payments/stripe/my-paymentsGET Get payment history /api/v1/payments/stripe/customer-portalPOST Create customer portal session /api/v1/payments/stripe/cancel-subscriptionPOST Cancel subscription /api/v1/payments/stripe/update-subscriptionPOST Change subscription plan
Authentication
Payment endpoints use different authentication methods based on the user type:
User Type Auth Method Header Developer OAuth2 Bearer Token Authorization: Bearer {jwt}End User HTTP Bearer Token Authorization: Bearer {jwt}Webhook Stripe Signature Stripe-Signature: {signature}
Test vs Live Mode
All Stripe endpoints support both test and live modes:
Test Mode : Uses test API keys (prefix sk_test_ / pk_test_), simulated payments
Live Mode : Uses live API keys (prefix sk_live_ / pk_live_), real payments
The test_mode query parameter controls which mode is used (defaults to true for safety).
Quick Start
First, add your Stripe API keys to your project:
curl -X PUT https://api.devkit4ai.com/api/v1/payments/stripe/projects/{project_id}/config \
-H "Authorization: Bearer {developer_jwt}" \
-H "Content-Type: application/json" \
-d '{
"test_secret_key": "sk_test_...",
"test_publishable_key": "pk_test_...",
"test_webhook_secret": "whsec_..."
}'
2. Get Webhook URLs
Configure webhooks in your Stripe dashboard:
curl https://api.devkit4ai.com/api/v1/payments/stripe/projects/{project_id}/webhook-urls \
-H "Authorization: Bearer {developer_jwt}"
3. Create Checkout Session
Create a checkout session for end users:
curl -X POST https://api.devkit4ai.com/api/v1/payments/stripe/checkout-session \
-H "Authorization: Bearer {end_user_jwt}" \
-H "Content-Type: application/json" \
-d '{
"price_id": "price_...",
"success_url": "https://yourapp.com/success",
"cancel_url": "https://yourapp.com/cancel"
}'
Webhook Events
The following Stripe webhook events are processed:
Event Action checkout.session.completedCreate subscription record customer.subscription.createdStore subscription details customer.subscription.updatedUpdate subscription status customer.subscription.deletedMark subscription cancelled invoice.paidRecord successful payment invoice.payment_failedRecord failed payment
Stripe Integration Tutorial Step-by-step guide to integrating Stripe
Cloud Admin Payments View payment analytics in Cloud Admin
Security Best Practices Secure your payment integration
Environment Variables Configure payment settings