-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correctly handle IPP failed orders #3689
Conversation
Thank you for addressing this, @wjrosa! ✅ I tested this branch on my store and Woo iOS and I can confirm that after a failed payment the order gets set to failed and the order note is added. 👍 Additionally, I tested repeated payment failures: tapping 'Try Collecting Again' which reuses the payment intent. We had problems with the same payment intent on WooPayments but it works well with Stripe Gateway. Mind, I had to modify the app to set the order back to pending before repeating a failed payment, otherwise the notes and other actions don't get made. This is a known semi-challenge that we're currently discussing within the team pdfdoF-66D-p2 and with WooPayments folks. It's outside the scope of this PR and we can make improvements to this later. Do you have any thoughts on this as well from Stripe Gateway's perspective, mainly:
I can create a GitHub issue and request if we settle on the solution on the WooPayments side. |
Thank you so much for reviewing and testing this, @staskus ! On the extension code, we have this block preventing different statuses from being handled by this method: if ( ! $order->has_status(
apply_filters(
'wc_stripe_allowed_payment_processing_statuses',
[ 'pending', 'failed' ],
$order
)
) ) {
return;
} So, at least in theory, we should be able to process failed payments with no additional changes required.
Here, all I can think of is:
That would be great 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM! And thanks for adding unit tests ✨
I tested a few failures -- can see the order is marked as failed and the order notes contain the specific reason. 🚢
Fixes #3631
Changes proposed in this Pull Request:
When we perform In-Person Payments and the payment fails, Stripe sends a
payment_intent.payment_failed
webhook event (as expected), but the body is a bit different: we may not have thesignature
property. Because of it, our webhook handler class fails to retrieve the associated order, skipping the whole failure processing code.This PR fixes the issue by adding two more ways of extracting the order ID from the webhook event body: from the
order_id
property inside themetadata
property, and thecharges
array.Testing instructions
failed
and a note is added:changelog.txt
andreadme.txt
(or does not apply)Post merge
cc @Mayisha @staskus