UNPKG

@unchainedshop/plugins

Version:

Official plugin collection for the Unchained Engine with payment, delivery, and pricing adapters

20 lines (19 loc) 626 B
import { createLogger } from '@unchainedshop/logger'; import handleWebhook from "./handle-webhook.js"; const logger = createLogger('unchained:cryptopay:handler'); const cryptopayHandler = async (req, res) => { if (req.method === 'POST') { try { await handleWebhook(req.body, req.unchainedContext); res.status(200).send({ success: true }); return; } catch (e) { logger.error(e); res.status(500).send({ success: false, error: e.message }); return; } } res.status(404).send(); }; export default cryptopayHandler;