Middleware for processing stripe webhooks.
MIT License
Node.js middleware for processing stripe webhooks. Inspired by: securing stripe webhooks with nodejs & stripe-webhook-server.
Currently this middleware only validates events that are sent to it.
Upcoming features include transactional emails, custom templates and support for callbacks (ex: looking up user info by customer data).
Install node dependencies:
npm install express body-parser stripe-webhook-middleware
Create app.js
:
var express = require('express');
var bodyParser = require('body-parser');
var app = express();
var stripeMiddleware = require('stripe-webhook-middleware');
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.post('/stripe', stripeMiddleware.init(app, {
stripeApiKey: 'your-private-api-key'
}));
app.listen(3000);
Run it with node app.js
.
Deploy it and add the url to your accounts webhooks - https://dashboard.stripe.com/account/webhooks.