To deploy an API Gateway as a proxy to a Lambda function that will serve as the handler for the incoming Stripe events (further information on the events that can be expected can be found here)
Create a Stripe account and retrieve your secret key from the console here.
Copy the secret key into your .env.local
using the example provided.
Ensure you have the Stripe CLI installed and run:
stripe listen --forward-to=127.0.0.1:4242
The log should print a message similar to this:
> Ready! Your webhook signing secret is whsec_yoursecret (^C to quit)
Copy the secret into your env.local
file, open another terminal window and run:
yarn invoke
This will start a local web server listening on 127.0.0.1:4242
which will recieve events from Stripe.
Any events sent over Stripe's API will be forwarded onto your local webserver. To simulate this locally using the CLI run:
stripe trigger <any.event.name>
cdk deploy
deploy this stack to your default AWS account/regioncdk diff
compare deployed stack with current statecdk synth
emits the synthesized CloudFormation template