You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have identified an issue with the handling of repeated card_present payment failures in WooPayments. Specifically, when a payment is retried for the same Payment Intent:
The webhook does not mark the order as failed since an identical order note already exists.
Use a physical test card and WooCommerce app to attempt a card_present payment with a designated decline response.
Observe the webhook behavior:
Order status is set to "failed".
An order note is added:
A payment of $2.01 failed using WooPayments (pi_3QQ3LsFxOPlITqSQ18tFkImm). With the following message: Your card was declined.
Retry the Payment:
Retry the payment for the same Payment Intent (pi_3QQ3LsFxOPlITqSQ18tFkImm).
Observe the webhook behavior:
Order status remains unchanged.
No new order note is added, and no order failure actions are triggered.
Feel free to contact @staskus to help reproduce and test the issue.
Expected behavior
Each payment attempt (initial or retried) should trigger the appropriate order status update, notes, and failure handling, regardless of whether the Payment Intent or error message is identical.
Separate the webhook handling for card_present payment failure to a separate method.
In process_webhook_payment_intent_failed, check if the payment method type is CARD_PRESENT, branch it to use a new Order_Service method, something like mark_terminal_payment_failed (as we already have had mark_terminal_payment_completed).
In the new mark_terminal_payment_failed method, add a note for each failure with additional unique info such as charge_id or payment_method_id or timestamp in the human-readable format. See pcreKM-3aC-p2#comment-4188
There's also a related issue with order status. mark_payment_failed (and subsequent actions) are skipped when the order is already in failed status. Therefore, the client is required to make a remote request to change the order to pending before making a payment again which is inefficient. Could there be a special case handling for card_present payments in this case as well?
There's also a related issue with order status. mark_payment_failed (and subsequent actions) are skipped when the order is already in failed status. Therefore, the client is required to make a remote request to change the order to pending before making a payment again which is inefficient. Could there be a special case handling for card_present payments in this case as well?
For posterity, #10050 was created for this case but then was closed as we can resolve it within this issue with the updated acceptance criteria.
Describe the bug
We have identified an issue with the handling of repeated card_present payment failures in WooPayments. Specifically, when a payment is retried for the same Payment Intent:
More context and discussion: pcreKM-3aC-p2 and #10050 (comment)
To Reproduce
Initial Payment Attempt:
card_present payment
with a designated decline response.Observe the webhook behavior:
Retry the Payment:
Observe the webhook behavior:
Feel free to contact @staskus to help reproduce and test the issue.
Expected behavior
Each payment attempt (initial or retried) should trigger the appropriate order status update, notes, and failure handling, regardless of whether the Payment Intent or error message is identical.
Acceptance Criteria
(Written by @htdat)
CARD_PRESENT
, branch it to use a newOrder_Service
method, something likemark_terminal_payment_failed
(as we already have hadmark_terminal_payment_completed
).mark_terminal_payment_failed
method, add a note for each failure with additional unique info such as charge_id or payment_method_id or timestamp in the human-readable format. See pcreKM-3aC-p2#comment-4188do_action( 'woocommerce_order_status_failed action' )
, and ensure a failure email sent to customers. See Handling card_present payment failures for already failed order #10050 (comment)Additional context
The text was updated successfully, but these errors were encountered: