♻️ Simplify the payment flow before order approval

This commit is contained in:
Philipp Stracker 2025-03-03 16:51:26 +01:00
parent ca76d33aa3
commit 7b579bfc9b
No known key found for this signature in database

View file

@ -946,15 +946,14 @@ class GooglepayButton extends PaymentButton {
if ( ! isApprovedByPayPal ) {
result = paymentError( 'TRANSACTION FAILED' );
} else if ( isApprovedByPayPal === 'action_required' ) {
await initiatePayerAction( orderId );
const success = await captureOrderServerSide( orderId );
if ( success ) {
result = paymentResponse( 'SUCCESS' );
} else {
result = paymentError( 'FAILED TO APPROVE' );
}
} else {
/**
* This payment requires a 3DS verification before we can process the order.
*/
if ( isApprovedByPayPal === 'action_required' ) {
await initiatePayerAction( orderId );
}
const success = await approveOrderServerSide( orderId );
if ( success ) {