-
Notifications
You must be signed in to change notification settings - Fork 216
Fix handling for "no such customer" response for customer payment_methods query #4561
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
Fix handling for "no such customer" response for customer payment_methods query #4561
Conversation
…n-payment-methods-fetch
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.
Pull Request Overview
This PR fixes an issue where the Stripe payment methods API repeatedly fails when a customer doesn't exist in Stripe, by properly caching empty results to prevent unnecessary repeat API calls.
- Adds error handling to detect when a Stripe customer doesn't exist based on specific error response fields
- Caches an empty array result when a customer is missing to prevent redundant API calls
- Updates changelog and readme to document the fix
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
includes/class-wc-stripe-customer.php | Adds error detection logic and caching for missing customers in payment methods API |
readme.txt | Documents the fix in the readme changelog |
changelog.txt | Records the fix in the main changelog |
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.
Nice find. I've replicated the issue and can confirm it's fixed on this branch.
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.
Nice fix, Dale! Looks good to me ✅
…n-payment-methods-fetch
…hods query (#4561) * Return and cache no payment methods when customer doesn't exist * Changelog
Related to #4560
Changes proposed in this Pull Request:
This PR ensures that when we receive an HTTP error from the Stripe
payment_methods
API, we now check if the customer doesn't exist based on theerror.type
,error.param
, anderror.code
fields in the response from Stripe. If the customer doesn't exist, we now populate the cached data with an empty array to prevent unnecessary repeat calls to Stripe.Testing instructions
payment_methods
APIpayment_methods
API that all return 400 statusespayment_methods
API calls are repeatedpayment_methods
API calls are repeatedpayment_methods
API calls are made, as we now have the data cachedChangelog entry
Changelog Entry Comment
Comment
Post merge