Skip to content

sjnprjl/nestjs-stripe

Repository files navigation

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published