Create, update and delete stripe webhooks with your app deployment
TypeScript/JavaScript:
npm i @cloudcomponents/cdk-stripe-webhook
Python:
pip install cloudcomponents.cdk-stripe-webhook
import { Construct, Stack, StackProps } from '@aws-cdk/core';
import { RestApi } from '@aws-cdk/aws-apigateway';
import { StripeWebhook } from '@cloudcomponents/cdk-stripe-webhook';
export class StripeWebhookStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);
const api = new RestApi(this, 'Endpoint');
api.root.addMethod('POST');
const secretKey = process.env.SECRET_KEY as string;
const events = ['charge.failed', 'charge.succeeded'];
new StripeWebhook(this, 'StripeWebhook', {
secretKey,
url: api.url,
events,
logLevel: 'debug',
});
}
}
See API.md.
See more complete examples.