From bde2eb8fbe2d5935d11276ec1beefa717fc24fb9 Mon Sep 17 00:00:00 2001 From: Himad M Date: Mon, 28 Jul 2025 20:31:23 -0400 Subject: [PATCH] Clean AppSwitch hash params on Pay for Order page --- .../js/modules/OnApproveHandler/onApproveForPayNow.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/ppcp-button/resources/js/modules/OnApproveHandler/onApproveForPayNow.js b/modules/ppcp-button/resources/js/modules/OnApproveHandler/onApproveForPayNow.js index 629e8871a..317bb12bf 100644 --- a/modules/ppcp-button/resources/js/modules/OnApproveHandler/onApproveForPayNow.js +++ b/modules/ppcp-button/resources/js/modules/OnApproveHandler/onApproveForPayNow.js @@ -1,7 +1,14 @@ +import resumeFlowHelper from '../Helper/ResumeFlowHelper'; + const onApprove = ( context, errorHandler, spinner ) => { return ( data, actions ) => { spinner.block(); errorHandler.clear(); + // Pay Now submits via form (not AJAX), so we can't detect payment errors. + // Preemptively remove hash params to prevent reload issues. + if ( resumeFlowHelper.isResumeFlow() ) { + resumeFlowHelper.cleanHashParams(); + } return fetch( context.config.ajax.approve_order.endpoint, { method: 'POST',