Stripe Webhook Playground

node v4.9.1
version: 1.0.0
endpointsharetweet
// Set up RunKit Endpoint with Express: https://runkit.com/docs/endpoint var express = require("@runkit/runkit/express-endpoint/1.0.0"); var app = express(exports); var bodyParser = require('body-parser'); var jsonParser = bodyParser.json(); // Testing your Stripe Webhooks: // Select "clone this notebook" from the sidebar menu // Make your edits to the webhook handler below and then click "publish" in the navbar above // Right click "endpoint" in the navbar and then "copy link address" // Now you into your Stripe webhook settings: https://dashboard.stripe.com/account/webhooks // Set up a new webhook endpoint by pasting the endpoint link from above // That's it, you're now ready to play around with the Stripe Webhooks // Navigate to the "endpoint logs" in the sidebar menu to inspect the Stripe webhook events // You can find more information on how to handle webhooks and verify events here: // https://stripe.com/docs/webhooks // Webhook Handler app.post("/", jsonParser, (req, res) => { try { var getParams = !req.query ? {} : req.query; var event_json = req.body; res.send({ eventId: event_json.id, getParams }); } catch(e) { console.log(e); } });
Once you create your Express app with the tonicExpress helper, it works like any other Express app. You can use middleware, declare routes, etc.
Loading…

no comments

    sign in to comment