304 lines
8.8 KiB
YAML
304 lines
8.8 KiB
YAML
# Stripe Payment Configuration
|
|
# Copy this file to your project root as `stripe-config.yml`
|
|
# The stripe-payment-implementer agent will read this for context
|
|
|
|
version: "1.0"
|
|
|
|
# Project payment configuration
|
|
project:
|
|
name: "My Project"
|
|
stripe_account_type: "standard" # standard, express, custom (for Connect)
|
|
|
|
# =============================================================================
|
|
# ENABLED PAYMENT TYPES
|
|
# =============================================================================
|
|
# Uncomment and configure the payment types your project uses
|
|
|
|
payment_types:
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# One-Time Payments
|
|
# ---------------------------------------------------------------------------
|
|
one_time_payment:
|
|
enabled: true
|
|
implementation: "checkout" # checkout, payment_intent, payment_link
|
|
products:
|
|
- id: "prod_basic"
|
|
name: "Basic Package"
|
|
price_cents: 2999
|
|
currency: "usd"
|
|
- id: "prod_premium"
|
|
name: "Premium Package"
|
|
price_cents: 9999
|
|
currency: "usd"
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Subscriptions
|
|
# ---------------------------------------------------------------------------
|
|
subscription:
|
|
enabled: true
|
|
implementation: "checkout" # checkout, subscription_api
|
|
trial_days: 14
|
|
plans:
|
|
- id: "plan_starter"
|
|
name: "Starter"
|
|
price_id: "price_xxxxx" # From Stripe Dashboard
|
|
interval: "month"
|
|
price_cents: 999
|
|
features:
|
|
- "5 projects"
|
|
- "Basic support"
|
|
- "1GB storage"
|
|
|
|
- id: "plan_pro"
|
|
name: "Pro"
|
|
price_id: "price_yyyyy"
|
|
interval: "month"
|
|
price_cents: 2999
|
|
features:
|
|
- "Unlimited projects"
|
|
- "Priority support"
|
|
- "10GB storage"
|
|
- "API access"
|
|
|
|
- id: "plan_enterprise"
|
|
name: "Enterprise"
|
|
price_id: "price_zzzzz"
|
|
interval: "year"
|
|
price_cents: 99900
|
|
features:
|
|
- "Everything in Pro"
|
|
- "Dedicated support"
|
|
- "Unlimited storage"
|
|
- "Custom integrations"
|
|
- "SLA guarantee"
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Metered/Usage-Based Billing
|
|
# ---------------------------------------------------------------------------
|
|
metered_billing:
|
|
enabled: false
|
|
metrics:
|
|
- id: "api_calls"
|
|
name: "API Calls"
|
|
price_id: "price_metered_api"
|
|
unit_label: "calls"
|
|
aggregate_usage: "sum"
|
|
tiers:
|
|
- up_to: 1000
|
|
unit_amount_cents: 0 # Free tier
|
|
- up_to: 10000
|
|
unit_amount_cents: 1 # $0.01 per call
|
|
- up_to: "inf"
|
|
unit_amount_cents: 0.5 # $0.005 per call
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Marketplace (Stripe Connect)
|
|
# ---------------------------------------------------------------------------
|
|
marketplace:
|
|
enabled: false
|
|
account_type: "express" # standard, express, custom
|
|
platform_fee:
|
|
type: "percentage" # percentage, fixed, both
|
|
percentage: 10 # 10% platform fee
|
|
fixed_cents: 0 # Additional fixed fee
|
|
payout_schedule: "automatic" # automatic, manual
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Invoicing
|
|
# ---------------------------------------------------------------------------
|
|
invoicing:
|
|
enabled: false
|
|
default_due_days: 30
|
|
collection_method: "send_invoice" # charge_automatically, send_invoice
|
|
auto_advance: true
|
|
footer: "Thank you for your business!"
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Payment Links
|
|
# ---------------------------------------------------------------------------
|
|
payment_links:
|
|
enabled: false
|
|
products: [] # Reference product IDs from one_time_payment or subscription
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Customer Portal
|
|
# ---------------------------------------------------------------------------
|
|
customer_portal:
|
|
enabled: true
|
|
features:
|
|
update_payment_method: true
|
|
cancel_subscription: true
|
|
switch_plans: true
|
|
view_invoices: true
|
|
update_billing_address: true
|
|
|
|
# =============================================================================
|
|
# PAYMENT METHODS
|
|
# =============================================================================
|
|
# Which payment methods to accept
|
|
|
|
payment_methods:
|
|
# Cards (always enabled)
|
|
cards:
|
|
enabled: true
|
|
brands:
|
|
- visa
|
|
- mastercard
|
|
- amex
|
|
- discover
|
|
|
|
# Digital Wallets
|
|
wallets:
|
|
apple_pay: true
|
|
google_pay: true
|
|
link: true # Stripe's 1-click checkout
|
|
|
|
# Bank Payments
|
|
bank:
|
|
us_bank_account: false # ACH
|
|
sepa_debit: false
|
|
|
|
# Buy Now Pay Later
|
|
bnpl:
|
|
afterpay_clearpay: false
|
|
klarna: false
|
|
affirm: false
|
|
|
|
# Regional Methods (uncomment as needed)
|
|
regional:
|
|
ideal: false # Netherlands
|
|
bancontact: false # Belgium
|
|
giropay: false # Germany
|
|
sofort: false # EU
|
|
boleto: false # Brazil
|
|
oxxo: false # Mexico
|
|
konbini: false # Japan
|
|
|
|
# =============================================================================
|
|
# WEBHOOK CONFIGURATION
|
|
# =============================================================================
|
|
# Which webhook events to handle
|
|
|
|
webhooks:
|
|
endpoint: "/api/webhooks/stripe"
|
|
|
|
# Payment events
|
|
payment_events:
|
|
- "payment_intent.succeeded"
|
|
- "payment_intent.payment_failed"
|
|
- "charge.refunded"
|
|
- "charge.dispute.created"
|
|
|
|
# Checkout events
|
|
checkout_events:
|
|
- "checkout.session.completed"
|
|
- "checkout.session.expired"
|
|
|
|
# Subscription events (if subscriptions enabled)
|
|
subscription_events:
|
|
- "customer.subscription.created"
|
|
- "customer.subscription.updated"
|
|
- "customer.subscription.deleted"
|
|
- "customer.subscription.trial_will_end"
|
|
- "invoice.paid"
|
|
- "invoice.payment_failed"
|
|
- "invoice.upcoming"
|
|
|
|
# Connect events (if marketplace enabled)
|
|
connect_events:
|
|
- "account.updated"
|
|
- "account.application.authorized"
|
|
- "account.application.deauthorized"
|
|
- "payout.paid"
|
|
- "payout.failed"
|
|
|
|
# =============================================================================
|
|
# DATABASE MAPPING
|
|
# =============================================================================
|
|
# How Stripe objects map to your database
|
|
|
|
database:
|
|
# User-Customer mapping
|
|
user_table: "users"
|
|
customer_id_field: "stripe_customer_id"
|
|
|
|
# Subscription tracking
|
|
subscription_table: "subscriptions"
|
|
subscription_fields:
|
|
stripe_subscription_id: "stripe_subscription_id"
|
|
stripe_price_id: "stripe_price_id"
|
|
status: "status"
|
|
current_period_start: "current_period_start"
|
|
current_period_end: "current_period_end"
|
|
|
|
# Order/Purchase tracking (for one-time payments)
|
|
order_table: "orders"
|
|
order_fields:
|
|
stripe_payment_intent_id: "stripe_payment_intent_id"
|
|
stripe_checkout_session_id: "stripe_checkout_session_id"
|
|
amount: "amount"
|
|
status: "status"
|
|
|
|
# =============================================================================
|
|
# ENVIRONMENT VARIABLES
|
|
# =============================================================================
|
|
# Reference for required environment variables
|
|
|
|
environment:
|
|
required:
|
|
- STRIPE_SECRET_KEY
|
|
- STRIPE_PUBLISHABLE_KEY
|
|
- STRIPE_WEBHOOK_SECRET
|
|
|
|
optional:
|
|
- STRIPE_PRICE_ID_STARTER
|
|
- STRIPE_PRICE_ID_PRO
|
|
- STRIPE_PRICE_ID_ENTERPRISE
|
|
|
|
# =============================================================================
|
|
# API ROUTES TO GENERATE
|
|
# =============================================================================
|
|
# Routes that should be created based on enabled features
|
|
|
|
routes:
|
|
# Checkout
|
|
- path: "/api/checkout"
|
|
method: "POST"
|
|
purpose: "Create checkout session"
|
|
requires: ["one_time_payment", "subscription"]
|
|
|
|
# Webhooks
|
|
- path: "/api/webhooks/stripe"
|
|
method: "POST"
|
|
purpose: "Handle Stripe webhooks"
|
|
requires: ["webhooks"]
|
|
|
|
# Customer Portal
|
|
- path: "/api/billing/portal"
|
|
method: "POST"
|
|
purpose: "Create customer portal session"
|
|
requires: ["customer_portal"]
|
|
|
|
# Subscription Management
|
|
- path: "/api/subscription"
|
|
method: "GET"
|
|
purpose: "Get current subscription"
|
|
requires: ["subscription"]
|
|
|
|
- path: "/api/subscription/cancel"
|
|
method: "POST"
|
|
purpose: "Cancel subscription"
|
|
requires: ["subscription"]
|
|
|
|
# Connect (Marketplace)
|
|
- path: "/api/connect/onboard"
|
|
method: "POST"
|
|
purpose: "Create Connect account link"
|
|
requires: ["marketplace"]
|
|
|
|
- path: "/api/connect/dashboard"
|
|
method: "GET"
|
|
purpose: "Get Connect dashboard link"
|
|
requires: ["marketplace"]
|