Skip to content

Latest commit

 

History

History
59 lines (45 loc) · 1.06 KB

README.md

File metadata and controls

59 lines (45 loc) · 1.06 KB
nestjs-stripe

Installation

npm install @sjnprjl/nestjs-stripe

Install stripe.

npm install stripe

Example

// app.module.ts
import { Module } from '@nestjs/common';
import { StripeModule } from '@sjnprjl/nestjs-stripe';
@Module({
  imports: [
    // ...
    StripeModule.forRoot({
      apiKey: 'your-secret-key',
      config: {
        apiVersion: '2022-11-15',
      },
    }),
    // ...
  ],
  // ...
})
export class AppModule {}

Now you can inject the stripe client into your services .

// app.service.ts
import { Inject, Injectable } from '@nestjs/common';
import { STRIPE_TOKEN } from '@sjnprjl/nestjs-stripe'; // provider token
import Stripe from 'stripe';

@Injectable()
export class AppService {
  constructor(@Inject(STRIPE_TOKEN) private stripeClient: Stripe) {}
}

Contributing

I am sure there are many things that this package must include. So, feel free to contribute to this repo for I am not so good coder.

License

Distributed under the MIT License.

Copyright @ 2022 Sujan Parajuli