woocommerce / woocommerce-gateway-stripe

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

Deprecate/adjust set_default_source #2863

Open claudiulodro opened 9 months ago

claudiulodro commented 9 months ago

Describe the bug

I was looking through the logs on a bunch of sites we host, and I noticed that every transaction generates a series of API requests to Stripe, one of which always responds with a 400 ERR error code:

Screenshot 2024-01-26 at 2 41 01 PM

(example)

The error is not phrased well, but default_source param of the API does not accept PaymentMethod pm_abcd1234 tokens. In fact that field appears to be deprecated in general. This appears to be the offending bit of code.

To Reproduce Steps to reproduce the behavior:

  1. Purchase something using WooCommerce with the Stripe Gateway as a new customer.
  2. Go to Stripe. Find the customer and go to their "Events & Logs" tab.
  3. Observe 4 requests to the API which respond with 200 and one which responds with 400:
Screenshot 2024-01-26 at 3 00 07 PM

Expected behavior Probably makes the most sense to use default_payment_method when the token starts with pm_ and default_source when the token starts with src_

Screenshots See above

Environment (please complete the following information):

n-dawson commented 9 months ago

I came across this on behalf of a client recently and was in the process of chasing it up with Stripe.

Having examined the API logs, it appears as though the error was first introduced in Stripe plugin version 7.3.0.

Pleased to discover these errors are of no concern and are already flagged.

carolframen commented 5 months ago

Another report 8257232-zen.