@unchainedshop/plugins
Version:
Official plugin collection for the Unchained Engine with payment, delivery, and pricing adapters
24 lines (23 loc) • 793 B
JavaScript
import { createLogger } from '@unchainedshop/logger';
import handleWebhook from "./handle-webhook.js";
const logger = createLogger('unchained:cryptopay');
export async function cryptopayWebhookHandler(request, context) {
try {
const body = (await request.json());
await handleWebhook(body, context);
return new Response(JSON.stringify({ success: true }), {
status: 200,
headers: { 'Content-Type': 'application/json' },
});
}
catch (error) {
logger.error('Cryptopay webhook error:', error);
return new Response(JSON.stringify({
success: false,
error: error.message,
}), {
status: 500,
headers: { 'Content-Type': 'application/json' },
});
}
}