Estados del payment intent
Transiciones
Cualquier operación fuera de estas transiciones responde 409 PAYMENT_INVALID_STATE (o
PAYMENT_ALREADY_TERMINAL si el intent ya terminó): reobtén el intent antes de decidir qué hacer.
| Operación | Llega a | Desde |
|---|---|---|
| pedir checkout | REQUIRES_ACTION | CREATED, REQUIRES_ACTION (nuevo checkout) |
| marcar en proceso | PROCESSING | REQUIRES_ACTION |
| autorizar | AUTHORIZED | REQUIRES_ACTION, PROCESSING |
| fallar | FAILED | REQUIRES_ACTION, PROCESSING |
| cancelar | CANCELLED | CREATED, REQUIRES_ACTION |
| expirar | EXPIRED | CREATED, REQUIRES_ACTION |
| devolver | PARTIALLY_REFUNDED → REFUNDED | AUTHORIZED, PARTIALLY_REFUNDED |
Estados terminales: FAILED, CANCELLED, EXPIRED y REFUNDED.
Garantías
- Un intent
AUTHORIZEDnunca vuelve a un estado anterior. - La suma de devoluciones nunca supera el monto autorizado.
- Un intent en estado terminal no acepta un checkout nuevo.
- Dos confirmaciones simultáneas del mismo pago no pueden autorizarlo dos veces: una de ellas recibe
409y el estado queda consistente.
Cómo se ve en la API
GET /v1/payment-intents/{id} devuelve el estado y el timeline con cada evento:
{
"id": "payi_01…",
"status": "AUTHORIZED",
"provider": "transbank_webpay_plus",
"amount": 25990,
"currency": "CLP",
"payment": { "id": "pay_01…", "status": "AUTHORIZED", "authorized_at": "…" },
"timeline": [
{ "type": "payment_intent.created", "at": "…" },
{ "type": "payment.checkout.started", "at": "…" },
{ "type": "payment.authorized", "at": "…" }
]
}