
Product
Introducing Socket Fix for Safe, Automated Dependency Upgrades
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
@isnolan/nestjs-subscription
Advanced tools
`SubscriptionModule` is a comprehensive subscription handling module for NestJS applications, providing seamless integration with multiple subscription platforms such as Stripe, Google Pay, and Apple Pay. It facilitates the handling of subscription events
SubscriptionModule
is a comprehensive subscription handling module for NestJS applications, providing seamless integration with multiple subscription platforms such as Stripe, Google Pay, and Apple Pay. It facilitates the handling of subscription events via webhooks, offering a unified approach to verify and process payment notifications securely.
`pnpm install --save @isnolan/nestjs-subscription`
To use SubscriptionModule, import and add it to the imports array of your NestJS module, typically AppModule. Here's how you can do it:
import { SubscriptionModule } from '@isnolan/nestjs-subscription';
@Module({
imports: [
SubscriptionModule.forRoot({
stripe: {
apiSecretKey: `${process.env.STRIPE_SECRET_KEY}`,
webhookSecret: `${process.env.STRIPE_SECRET_WEBHOOK}`,
},
apple: {
signingKey: `${process.env.APPLE_SIGNING_KEY}`,
keyId: `${process.env.APPLE_KEY_ID}`,
issuerId: `${process.env.APPLE_ISSUER_ID}`,
bundleId: `${process.env.APPLE_BUNDLE_ID}`,
environment: 'Sandbox',
},
}),
],
providers: [AppService],
})
export class AppModule {}
SubscriptionModule also supports asynchronous configuration, which is useful when the configuration needs to be dynamically determined at runtime.
import { SubscriptionModule } from '@isnolan/nestjs-subscription';
import { ConfigService } from '@nestjs/config';
@Module({
imports: [
SubscriptionModule.forRootAsync({
inject: [ConfigService],
useFactory: async (config: ConfigService) => config.get('subscription'),
}),
],
providers: [AppService],
})
export class AppModule {}
The webhooks url is
Follow the instructions from the Stripe Documentation for remaining integration steps such as testing your integration with the CLI before you go live and properly configuring the endpoint from the Stripe dashboard so that the correct events are sent to your NestJS app.
事件生命周期 | Apple Pay | Google Pay | Stripe |
---|---|---|---|
订阅创建 | subscription_created | SUBSCRIPTION_STATE_PENDING | customer.subscription.created |
订阅付款 | subscription_renewed | SUBSCRIPTION_RENEWED | customer.subscription.updated |
订阅取消 | subscription_canceled | SUBSCRIPTION_CANCELED | customer.subscription.deleted |
订阅过期 | subscription_expired | SUBSCRIPTION_EXPIRED | customer.subscription.expired |
付款成功 | payment_success | PAYMENT_SUCCESS | invoice.payment_succeeded |
付款失败 | payment_failed | PAYMENT_FAILED | invoice.payment_failed |
State | Apple Pay | Google Pay | Stripe |
---|---|---|---|
PENDING | INITIAL_BUY | SUBSCRIPTION_STATE_PENDING | customer.subscription.created |
Active | subscription_created | SUBSCRIPTION_STATE_ACTIVE | customer.subscription.created |
Paused | subscription_created | SUBSCRIPTION_STATE_ON_HOLD | customer.subscription.created |
Canceled | subscription_created | SUBSCRIPTION_STATE_CANCELED | customer.subscription.created |
Expired | subscription_created | SUBSCRIPTION_STATE_EXPIRED | customer.subscription.created |
Contributions welcome! Read the contribution guidelines first.
FAQs
`SubscriptionModule` is a comprehensive subscription handling module for NestJS applications, providing seamless integration with multiple subscription platforms such as Stripe, Google Pay, and Apple Pay. It facilitates the handling of subscription events
The npm package @isnolan/nestjs-subscription receives a total of 0 weekly downloads. As such, @isnolan/nestjs-subscription popularity was classified as not popular.
We found that @isnolan/nestjs-subscription demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
Security News
CISA denies CVE funding issues amid backlash over a new CVE foundation formed by board members, raising concerns about transparency and program governance.
Product
We’re excited to announce a powerful new capability in Socket: historical data and enhanced analytics.