woocommerce/woocommerce-gateway-stripe

[Wallets] Cash App payments - Second attempt to pay for an order fails

Closed this issue · 6 comments

Describe the bug

The second attempt to pay for a failed order fails, even though the select path is to authorize the payment.

To Reproduce
Steps to reproduce the behavior:

  1. Check out the branch issue/3141-add-payment-processing-for-cashapp if #3143 isn't merged yet
  2. As a merchant, enable Cash App under the Payment methods tab, at wp-admin/admin.php?page=wc-settings&tab=checkout&section=stripe&panel=methods
  3. As a shopper, add a product to the cart and go to the checkout page
  4. Select Cash App as the payment method and place the order
  5. When redirected to the Stripe test page, select "Fail test payment"
  6. Notice you get redirected to the Order placed page, with an error message. All good
  7. Click on "Pay" to retry placing the order
  8. Select Cash App and place the order
  9. Notice an error message is displayed on the checkout page, without the Cash App modal being displayed

Expected behavior

I expect the Cash App modal to be displayed without any error message.

Screenshots

zhVQB2.mp4

Other unexpected behaviors
After step 9:

  • The order is successfully placed if you try again
  • If you retry from the phone, the Order received page says that the payment failed, but the payment was actually placed successfully. The order has a "Processing" status, and the payment is registered in Stripe.

@a-danae thanks for filing the issue and explaining how to replicate it so clearly. I think I've resolved the issue on #3143 of it not allowing you to reattempt payment. See this comment #3143 (comment). :)

If you retry from the phone, the Order received page says that the payment failed, but the payment was actually placed successfully. The order has a "Processing" status, and the payment is registered in Stripe.

I was able to replicate this. I think the issue is that payment processing of wallet payments is exclusively done via webhooks and when you are redirected to the order received page, the failure note at the top of the page is reflecting to previous failed status, the webhook hasn't been received yet that processes the successful payment.

At some point I was going to look at adding query params to the return URL that would enable us to do something similar to other UPE redirect payment methods and process the response when the customer lands back on the site. That might be something worth looking at.

At some point I was going to look at adding query params to the return URL that would enable us to do something similar to other UPE redirect payment methods and process the response when the customer lands back on the site. That might be something worth looking at.

So I was doing some digging around on this and Stripe's docs suggest that customers will be redirected to a URL with payment_intent, payment_intent_client_secret, redirect_pm_type, and redirect_status but only when paying on mobile.

Payments initiated from a desktop web browser don't work like that.

Stripe Doc: https://docs.stripe.com/payments/cash-app-pay/accept-a-payment?web-or-mobile=web&payments-ui-type=elements&lang=php#handle-redirect

I'm going to un-assign myself in case someone wants to pick up this issue in terms of looking into supporting the UPE redirect for Cashapp (and possibly WeChat too).

Sorry for the abundance of comments here but I wanted to add some additional notes as I reach the end of my day.

Payments initiated from a desktop web browser don't work like that.

While this is true, because Cash App requires the customer to use their phone to complete the payment, the customer on their phone will eventually be redirected back to the site on their device and that URL will include those additional params I mentioned. Namely: payment_intent, payment_intent_client_secret, redirect_pm_type, and redirect_status.

In that case it might be possible to process the UPE redirect like we do with other payment methods but it will be the redirect on the phone that triggers it, not the redirect on the desktop.

I think I've resolved the issue on #3143 of it not allowing you to reattempt payment. See this comment #3143 (comment). :)

Yayy 🎉 thanks!

I'll create a separate issue for handling the redirect since the main problem from this GH issue was already resolved.

And amazing dive! Thanks for the details on how the redirect is processed, @james-allan !

That was really helpful for me to understand the issue and the flow, @james-allan ! Thank you.

Yeah, it makes sense. Closing this one. Also, I have a draft PR to fix the redirect issue.