Ir al contenido

Entrega al Checkout

Entrega nextAction.url como enlace o QR, exactamente como la devuelve payments.create:

import { createTimbroPayments } from "@timbro/payments";
const secretKey = process.env.TIMBRO_PAYMENTS_SECRET_KEY;
if (!secretKey) throw new Error("Missing TIMBRO_PAYMENTS_SECRET_KEY");
const timbro = createTimbroPayments({ secretKey });
const payment = await timbro.payments.create({
idempotencyKey: "create-order-123",
saleReference: "order-123",
amount: { currency: "DOP", minorUnits: 125_000 },
description: "Servicio de mantenimiento",
fiscalDocument: null,
});
const checkoutUrl = payment.nextAction?.url;
if (!checkoutUrl) throw new Error("Payment has no Checkout action");

El Checkout muestra la identidad del comercio desde registros del servidor, limita la sesión al pago y permite pagar como invitado cuando el flujo lo admite. Abre la URL en un contexto de nivel superior y conserva payment.id para recuperar.

No pongas PAN, CVC, credenciales ni tokens de proveedor en la URL. El Checkout es dueño de la experiencia del pagador; tu sistema conserva la referencia y consulta el estado por servidor.

No interpretes el retorno del navegador como autorización. Tu servidor consulta GET /v1/payments/{paymentId} y espera un estado terminal antes de cumplir; verifying requiere reconciliación.