Automattic / woocommerce-payments

Accept payments via credit card. Manage transactions within WordPress.
https://wordpress.org/plugins/woocommerce-payments/
Other
175 stars 69 forks source link

Failed Apple Pay consumed YITH gift card. #7858

Closed geektzu closed 10 months ago

geektzu commented 11 months ago

Describe the bug

The Apple Pay transaction failed but the gift card was deemed consumed at the backend. The WooCommerce front-end still treated the gift card as valid, and the user attempted to use WooPayments to pay via credit card for the difference.

The new sales order only registered the difference paid. But the Stripe transaction was charged at the total amount (including the gift card value) Not able to refund the total amount via wp-admin or Woo API.

To Reproduce

  1. Add a YITH gift card to a cart
  2. Pay via WooPayments Apple Pay
  3. Simulate a failed Apple Pay transaction
  4. Continue to pay via WooPayments credit card

Actual behavior

Order 110087 was attempted with a redeemed gift card. Order 110087 failed due to AVS mismatch. The customer attempted a second order. Order 110089 was created. The customer completed the order.

Screenshots

  1. Order 110089 FireShot Capture 002 - Edit order “Order – November 17, 2023 @ 10_08 AM” ‹ JOOLA USA — WordP_ - joolausa com
  2. Order 110087 FireShot Capture 001 - Edit order “Order – November 17, 2023 @ 10_06 AM” ‹ JOOLA USA — WordP_ - joolausa com

Expected behavior

The YITH gift card should not be consumed in order 110087 or The user should not have been allowed to start another new order (110089) when Apple Pay failed (and the same gift card was still deemed valid by the store frontend).

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context

P2: https://woocustomersuccess.wordpress.com/2023/12/06/journey-to-launch-woopayments-for-joola-usa/

geektzu commented 11 months ago

@pierorocca

csmcneill commented 11 months ago

@geektzu A couple of recommendations, please:

  1. Remove these screenshots from Droplr.
  2. Redact any customer information using solid colors (see pbg9X-gVx-p2 for more details).
  3. Embed the updated screenshots in GitHub.

Thank you!

pierorocca commented 11 months ago

@frosso could you add this to your maintenance queue please? I can't tell if the YITH extension is at issue here or if WooPayments is the problem.

frosso commented 11 months ago

@pierorocca thanks for the ping - would you have any suggestions on priority? On one hand, this seems to be related to the specific YITH extension, but on the other hand it might be hiding a more serious underlying problem.

pierorocca commented 11 months ago

@frosso given it's tied to a larger account, see the referenced P2, it'd be great if we can at least determine if it's WooPayments or Yith related and the scope of the problem to then determine and assign priorty. I.e. lacking key info to assess severity.

gpressutto5 commented 10 months ago

Potential long-term solution: Woo core or WooPayments might need to consider rolling back the gift card if an express payment method fails

WooPayments does not control Gift Cards. Instead, the Gift Card extensions are responsible for rolling back when the order fails. For example:

The problem with YITH's logic is that if an error happens and for some reason the order is not updated to "failed", the Gift Card will not get its balance back. This is not the case here because I can see order 110087 was updated to failed:

image

That said, is this still an issue? I couldn't reproduce it locally and found the logic to handle failed orders in YITH Gift Cards source code. This logic was added in version 2.3.0, released on 05 August 2019.

gpressutto5 commented 10 months ago

I'm closing this issue for now. Feel free to re-open it if the problem persists.