Integra con @vexpay/node
SDK oficial de TypeScript/Node con recursos tipados, reintentos seguros y verificación de webhooks.
Instalación
npm install @vexpay/nodeimport VexPay from '@vexpay/node';
const vexpay = new VexPay(process.env.VEXPAY_API_KEY, {
// baseUrl: 'http://localhost:3010', // gateway local
});Pago C2P
const intent = await vexpay.payments.c2p.request({
usdAmount: 12.5,
debtorId: 'V12345678',
debtorCellPhone: '584121234567',
debtorBankCode: 102,
externalRef: 'order_1042',
});
const receipt = await vexpay.payments.c2p.execute({
intentId: intent.intentId,
usdAmount: 12.5,
debtorId: 'V12345678',
debtorCellPhone: '584121234567',
debtorBankCode: 102,
token: customerToken,
externalRef: 'order_1042',
});Sesión de checkout
const session = await vexpay.checkout.sessions.create({
amountUsd: 25,
reference: 'order-1042',
allowedOrigins: ['https://shop.example'],
});
// Entrega session.clientSecret a @vexpay/js en el navegador.
// Confirma el fulfillment con GET o webhooks payment.* — nunca solo con eventos del navegador.Verificar webhooks
Consulta Webhooks para el contrato de firma. Usa `vexpay.webhooks.constructEvent(rawBody, header, secret)`.