woocommerce / woocommerce-gateway-stripe

The official Stripe Payment Gateway for WooCommerce
https://wordpress.org/plugins/woocommerce-gateway-stripe/
236 stars 206 forks source link

Cash App payments fail in live mode #3365

Closed csmcneill closed 2 months ago

csmcneill commented 2 months ago

Describe the bug When a customer attempts to place an order with the Cash App payment method selected, the QR code modal does not appear if the Stripe for WooCommerce extension is configured to accept live payments. Instead, the following error is displayed:

The payment failed.

When assessing the logs in Stripe, this the result of a payment_intent_payment_attempt_failed error and an invalid_request_error error in request to confirm a PaymentIntent.

To Reproduce Steps to reproduce the behavior:

  1. Enable the Cash App payment method.
  2. Ensure that test mode is disabled.
  3. Add a product to your cart.
  4. Proceed to checkout.
  5. Select the Cash App payment method.
  6. Place the order.
  7. Note the error.
  8. Check the logs.
  9. Check the network request for the confirm request.

Expected behavior The Cash App payment method displays a QR code modal without encountering an error.

Screenshots image

Additional context 8590733-zen 8575609-zen 8459070-zen 8394685-zen

csmcneill commented 2 months ago

Looking at Stripe's doc on the topic, they recommend adding a payment_method array in confirmCashappPayment here:

const form = document.getElementById('payment-form');

form.addEventListener('submit', function(event) {
  event.preventDefault();

  // Pass the clientSecret obtained from the server in step 2 as the first argument
  stripe.confirmCashappPayment(
    clientSecret,
    {
      payment_method: {
        type: 'cashapp',
      },
      return_url: 'https://www.example.com/checkout/done',
    },
  );
});

It looks like we do something similar with WeChat Pay by adding wechat_pay to the payment_method_options list...

https://github.com/woocommerce/woocommerce-gateway-stripe/blob/7eec27eb1d99b4bbc13ed8c91e20593f1a8b9bd0/client/classic/upe/payment-processing.js#L444-L454)

...but not for Cash App Pay:

https://github.com/woocommerce/woocommerce-gateway-stripe/blob/7eec27eb1d99b4bbc13ed8c91e20593f1a8b9bd0/client/classic/upe/payment-processing.js#L455-L461

I'm not sure if adding a payment_method array for Cash App Pay is required here and — its absence would be causing this issue?