fix(checkout): restaurar carrito al volver del redirect sin completar pago#5
fix(checkout): restaurar carrito al volver del redirect sin completar pago#5
Conversation
Magento consumes the quote (cart) when placing the order before redirecting to Fintoc. If the customer hits browser back without completing payment, the cart appears empty. Restoring the quote right before returning the redirect_url keeps the cart alive during the redirect. The success page clears the quote naturally on payment completion; the cancel callback is idempotent (already calls restoreQuote in processCancelAction).
| throw new LocalizedException(__('Invalid response from Fintoc API')); | ||
| } | ||
|
|
||
| try { |
There was a problem hiding this comment.
No entendí, cuando se llama esto? Antes de redireccionar al usuario al Checkout de Fintoc? Si es así, no creo que sea la mejor opción, puede pasar que tengas 2 pagos al mismo tiempo para el mismo carrito.
There was a problem hiding this comment.
La Anto me acuerdo que estaba haciendo algo para hacer expired el pago cuando el usuario se va de la página, tal vez es mejor escuchar ese webhook y con eso devolver el carrito
There was a problem hiding this comment.
Esto se llama cuando el usuario vuelve del Checkout de Fintoc, pero no por el cancel_url, entonces lo que antes pasaba es que el carrito no se hacíaa restore (solo se hacía cuando llegaba por cancel_url). Por eso aplicamos esta misma lógica fuera del scope
Contexto
Cuando el cliente vuelve al store sin completar el pago en Fintoc (botón atrás del navegador), el carrito aparece vacío. Magento cierra el carrito al crear la orden antes del redirect, y los handlers existentes con
restoreQuote()solo se ejecutan cuando Fintoc redirige porcancel_url. Entonces cuando el usuario volvía atrás, por otro lado que no sea elcancel_url, no se restauraba el carrito.quote = carritoCausa raíz
Place Order→ Magento crea la orden →quote.is_active = 0(carrito muerto)redirect_urlpay.fintoc.comCommitcontroller →restoreQuote()no se ejecuta →/checkout/cartlo ve vacío.Solución
Agregar un
restoreQuote()enController/Checkout/Create.phpjusto antes de devolver elredirect_urlal frontend.Grabacion.de.pantalla.2026-05-08.a.la.s.5.35.15.p.m.mov