Skip to content

Latest commit

 

History

History
42 lines (32 loc) · 1.13 KB

README.md

File metadata and controls

42 lines (32 loc) · 1.13 KB

Nestjs Stripe

This libs has wrap service for Stripe API and web endpoints (with Swagger) to call Stripe API Uses in nestjs projects.

Include Webhooks listeners and Stripe Event enums.

Adding to your project

  • npm install --save @valor/nestjs-stripe
  • yarn add @valor/nestjs-stripe

Use in application

There are two ways use StripeModule in application

  • Using StripeModule#forRootAsync method in imports

StripeModule.forRootAsync({
  useFactory: (config: AppConfigService) => ({
    apiKey: config.values.stripe.apiKey,
    webHookSignature: config.values.stripe.webHookSignature,
    successUrl: 'http://localhost:3333/purchase-success',
    cancelUrl: 'http://localhost:3333/card',
    currency: 'usd'
  }),
  inject: [AppConfigService]
}, AppAuthGuard)
  • Using StripeModule#forRoot method in imports

StripeModule.forRoot({
  apiKey: process.env.STRIPE_API_KEY,
  webHookSignature: process.env.STRIPE_WEBHOOK_SIGNATURE,
  successUrl: 'http://localhost:3333/purchase-success',
  cancelUrl: 'http://localhost:3333/card',
  currency: 'usd'
}, AppAuthGuard)