Stripe REST API
NestJS module wrapper for Stripe service with dependency injection.
What It Does
The Stripe REST API provides a NestJS module that wraps the @engineering11/stripe service, making Stripe payment functionality globally available through dependency injection with flexible credential management.
Key Capabilities
- NestJS Integration: Global module with DI support
- Flexible Credentials: Direct API key or GCP Secrets Manager
- Global Availability: Service accessible throughout application
- Type Safety: Full TypeScript support
- Easy Initialization: Single
.forRoot()call
Main Component
StripeModule
@Module({
imports: [
StripeModule.forRoot({
stripeApiSecretName: 'stripe_api_key' // Or stripeApiKey: 'sk_...'
})
]
})
export class AppModule {}Injection Pattern
@Injectable()
export class PaymentService {
constructor(
@Inject(STRIPE_SERVICE) private stripe: StripeService
) {}
async createCustomer() {
return this.stripe.customer.create({...})
}
}Configuration
IStripeModuleOptions
{
stripeApiKey?: string // Direct API key
stripeApiSecretName?: string // GCP Secret name
}One of these must be provided.
Stripe Service Capabilities
Full StripeService from @engineering11/stripe:
- Customer management (get, create, update)
- Payment methods (list, create, delete, retrieve)
- Payment intents (create, cancel, list)
- Products (create, update, delete)
- Prices (create, update)
- Subscriptions (create, cancel, retrieve, update)
Common Use Cases
- E-commerce payment processing
- SaaS subscription billing
- Customer payment method storage
- Product catalog management
- Payment intent processing
What Customers Don’t Have to Build
- Stripe NestJS integration
- Service initialization logic
- Credential management
- Global module configuration
- Dependency injection setup
- StripeService factory
Last updated on