Skip to content

Commit 8d3f062

Browse files
committed
fix: always include payment ID in card payment redirect URL
- Always add payment ID, order ID, and status to redirect URL after confirmPayment() - Ensures verify_and_complete_order() can fetch payment and complete order - Fixes race condition where order shows as unpaid for embedded card payments - Matches PrestaShop's unified flow approach Previously only included payment ID when saving payment method, causing orders to show as "not paid" when user didn't check "save payment method"
1 parent 70ca589 commit 8d3f062

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

assets/js/components/monei-cc-component.js

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -218,17 +218,14 @@ export const MoneiCCContent = ( props ) => {
218218
failUrl.searchParams.set( 'status', 'FAILED' );
219219
window.location.href = failUrl.toString();
220220
} else {
221-
let redirectUrl = paymentDetails.completeUrl;
222-
223-
if ( shouldSavePayment === true ) {
224-
const { orderId, paymentId } = paymentDetails;
225-
const url = new URL( paymentDetails.completeUrl );
226-
url.searchParams.set( 'id', paymentId );
227-
url.searchParams.set( 'orderId', orderId );
228-
redirectUrl = url.toString();
229-
}
230-
231-
window.location.href = redirectUrl;
221+
// Always include payment ID in redirect URL for order verification
222+
const { orderId, paymentId } = paymentDetails;
223+
const url = new URL( paymentDetails.completeUrl );
224+
url.searchParams.set( 'id', paymentId );
225+
url.searchParams.set( 'orderId', orderId );
226+
url.searchParams.set( 'status', result.status );
227+
228+
window.location.href = url.toString();
232229
}
233230
} catch ( error ) {
234231
console.error(

0 commit comments

Comments
 (0)