Stripe API
Wrapper around Stripe SDK for payment processing, subscriptions, and customer management.
What It Does
The Stripe API provides a streamlined, type-safe interface for Stripe payment operations with secure credential management via Google Cloud Secrets. It simplifies common payment processing tasks including one-time payments, subscriptions, customer management, and payment methods.
Key Capabilities
- Secure Credentials: API key retrieval from GCP Secrets Manager
- Customer Management: Create, update, and retrieve customer records
- Payment Methods: Manage customer payment methods
- Payment Intents: Process one-time payments
- Subscriptions: Recurring billing management
- Products & Pricing: Catalog management
- Type Safety: Full TypeScript support with Stripe types
Main Components
StripeService
Organized into functional modules:
- customer: Customer CRUD operations
- paymentMethods: Payment method management
- paymentIntent: Payment intent creation and management
- product: Product catalog management
- price: Pricing management
- subscription: Subscription lifecycle
Initialization
// From GCP Secret
StripeService.fromGcpSecret('stripe_api_key', options)
// Direct
StripeService.fromSecret(apiKey, options)Common Operations
Create Payment Intent
const intent = await stripe.paymentIntent.createPaymentIntent({
amount: 2000,
currency: 'usd',
customer: customerId,
payment_method: methodId
})Create Subscription
const subscription = await stripe.subscription.create({
customer: customerId,
items: [{price: priceId}]
})Configuration
- API Version: 2022-11-15
- Secret Name: Retrieved from GCP Secrets Manager
- Currency: Automatic lowercase normalization
Common Use Cases
- E-commerce payment processing
- SaaS subscription billing
- Customer payment method storage
- Product catalog management
- Recurring payments
What Customers Don’t Have to Build
- Stripe SDK integration
- Secure API key management
- Payment method management
- Subscription lifecycle handling
- Customer management
- Type-safe Stripe operations
- Currency normalization
Last updated on