Security News
Opengrep Emerges as Open Source Alternative Amid Semgrep Licensing Controversy
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
@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 healthy version release cadence and project activity because the last version was released less than 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.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.