# nestjs-stripe
nestjs-stripe is a NestJS module for integrating Stripe into your application, and it provides some built-in payment flows for easy implementation.
npm i @stack-pulse/nestjs-stripe yarn add @stack-pulse/nestjs-stripeNest.js and Stripe are peer dependencies.
import { StripeModule } from '@stack-pulse/nestjs-stripe';
import { ConfigModule, ConfigService } from '@nestjs/config';
@Module({
imports: [
StripeModule.forRootAsync({
imports: [ConfigModule],
useFactory: (configService: ConfigService) => ({
apiKey: configService.get('STRIPE_SECRET_KEY'),
config: { apiVersion: "2023-08-16" }
}),
inject: [ConfigService]
})
],
controllers: [YourController],
})
export class YourModule {}Then, use the ervice:
import { Controller, Get, Inject } from "@nestjs/common";
import { StripeService } from '@stack-pulse/nestjs-stripe';
@Controller("your-route-path")
export class YourController {
constructor(
@Inject(StripeService)
private readonly stripeService: StripeService
) {}
@Get()
public async yourRoute() {
const client = this.stripeService.client
}
} //Stripe Client
const client = this.stripeService.client__create_customer()
__get_payment_methods()
__get_default_payment_method()
__set_default_payment_method()
__detach_payment_method()
payment_intent() //for futre and non future both
__check_payment_method(payment_method,customer_id)This project is licensed under the MIT License - see the LICENSE.md file for details.
32