Webhooks Setup
Subscribe to webhooks
router.post("/handsin/webhooks", async (req, res, next) => {
const event = req.body.event;
switch(event){
case "MultiCardCompleted": {
const orderId = getReference(req.body.multiCardId);
// ... complete order logic
completeOrder(orderId);
reduceStock(orderId);
return res.status(200).send();
}
case "MultiCardCancelled": {
const orderId = getReference(req.body.multiCardId);
// ... cancel order logic
cancelOrder(orderId);
return res.status(200).send();
}
case "MultiCardExpired": {
const orderId = getReference(req.body.multiCardId);
// ... cancel order logic
cancelOrder(orderId);
return res.status(200).send();
}
default:{
return res.status(200).send();
}
}
Updated 3 days ago