-
Notifications
You must be signed in to change notification settings - Fork 216
Fix/632 show generic error to customers when invalid keys #4536
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/632 show generic error to customers when invalid keys #4536
Conversation
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 improves the user experience during checkout by replacing technical error messages with a more customer-friendly message when Stripe API keys are invalid. While the detailed error information is preserved in logs and order notes for debugging purposes, customers now see a generic message that doesn't expose technical implementation details.
- Replace technical "Invalid API Key" error message with user-friendly checkout error
- Preserve detailed error information in logs and order notes for debugging
- Update changelog and readme to document the improvement
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
includes/payment-methods/class-wc-stripe-upe-payment-gateway.php | Adds error message handling to show generic message for invalid API key errors |
readme.txt | Documents the change in the changelog |
changelog.txt | Adds changelog entry for the error message improvement |
includes/payment-methods/class-wc-stripe-upe-payment-gateway.php
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
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! Looks good to me 👍
Fixes STRIPE-632
Changes proposed in this Pull Request:
This PR replaces the error message displayed during checkout when the Stripe API Key is invalid; we specifically mention that the payment was not processed, and then use a message similar to what we use when no payment methods are available (as this is the same case, with an invalid API key all payment methods will fail).
The logs entry and the order note still show the full error message for debugging purposes.
For context, when there are no payment methods available during checkout, the message look like this:

Testing instructions
develop
branchsecret_key
with an invalid value:wp option patch update woocommerce_stripe_settings test_secret_key 'sk_test_INVALID'
Changelog entry
Changelog Entry Comment
Comment
Post merge