Skip to main content
@zopay/js exporta tipos TypeScript públicos para que tu código tipe correctamente las opciones del widget y el poller, y el shape que tu callback checkStatus debe devolver.
import type {
  PaymentIntent,
  StatusInfo,
  MountPaymentWidgetOptions,
  CreatePollerOptions,
} from "@zopay/js";

PaymentIntent

El envelope que tu backend devuelve tras crear el intent y le pasas al widget en options.intent. Mismo shape que la respuesta de POST /payment-intents.

StatusInfo

El shape que el callback checkStatus debe devolver. Lo más fácil: pasa la respuesta del API a normalizeIntent y deja que produzca el StatusInfo por ti. Campos clave que el widget consume:
CampoTipoNotas
phase"pending" | "partial" | "completed" | "failed" | "expired"Estado lógico del intent. normalizeIntent lo deriva de status + partial_payment + amount_received.
amountReceivednumberCumulativo. Para mostrar barras de progreso de pago parcial.
amountRemainingnumberLo que falta para completar.
txHashstring | nullHash del último depósito, cuando existe.
addressReceiverstring | nullDirección que recibió el último depósito.

MountPaymentWidgetOptions

Configuración del widget. Ver tabla completa en mountPaymentWidget.

CreatePollerOptions

Configuración del poller sin UI. Ver createPoller.