Skip to content

Instantly share code, notes, and snippets.

@bryceadams
Last active April 17, 2016 23:55
Show Gist options
  • Select an option

  • Save bryceadams/e3be6505ca6e1136c69ac88e7edf455b to your computer and use it in GitHub Desktop.

Select an option

Save bryceadams/e3be6505ca6e1136c69ac88e7edf455b to your computer and use it in GitHub Desktop.
/**
* This is the endpoint WC needs to post through a webhook to,
* when a new sale has been made.
*/
app.post('/print', function (req, res) {
var webhookBody = req.body || {};
var webhookSignature = req.headers['x-wc-webhook-signature'];
console.log('Receiving webhook...');
if (!webhookBody || !webhookSignature) {
console.log('Access denied - invalid request');
return res.send('access denied', 'invalid request', null, 403);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment