Comments (5)
code
should be correct per Stripe's reference docs seen here https://stripe.com/docs/api#errors
from woocommerce-gateway-stripe.
I'm the original poster on the WP support area. - I've investigated this a little more. It ends up this only occurs on empty form submission.
If you submit an empty form to stripe, it returns an error message without a code.
Empty form response:
{
"error": {
"type": "invalid_request_error",
"message": "Could not find payment information"
}
}
If the form has any data it will return with a code
Example response:
{
"error": {
"message": "Your card's expiration year is invalid.",
"type": "card_error",
"param": "exp_year",
"code": "invalid_expiry_year"
}
}
The problem being it's not currently possible to localise the empty form error response.
from woocommerce-gateway-stripe.
@roykho you have added messages only for card_error type and assumed that any responseObject will have a code, but as you can see in the results pasted by @netplus and also in the Stripe docs, there also additional error types and not all types have a code, some of them only have a type and message. From the Stripe.com docs linked above:
The type of error returned. Can be: api_connection_error, api_error, authentication_error, card_error, invalid_request_error, or rate_limit_error.
The appropriate solution would be check responseObject.response.error.type to determine what data contains the responseObject (e.g. it has a code or not?) and proceed accordingly. That is basically what Stripe.com is recommending with this:
Handling errors
Our API libraries raise exceptions for many reasons, such as a failed charge, invalid parameters, authentication errors, and network unavailability. We recommend writing code that gracefully handles all possible API exceptions.
from woocommerce-gateway-stripe.
@samuelaguilera - this has already been flagged a bug so it is known and will be fixed by next release.
from woocommerce-gateway-stripe.
@roykho great! just commented because of your comment after flagging it as a bug and also seeing that it was labeled as "needs author reply" days after that. Just wanted to add some light here :)
from woocommerce-gateway-stripe.
Related Issues (20)
- invalid issue
- Payment method shows even when it cannot be used
- New Checkout experience won't load asset files if the plugin is symlinked HOT 1
- getting error on checkout for cardInput, scrollIntoView and validateInput
- Change button text 'Activate stripe account' when other payment methods require activation in the Stripe dashboard. HOT 1
- [HC] Logs report outdated Stripe API version by default?
- Investigate intermittent issue with processing payments via webhook where UPE redirect never occurs HOT 5
- Sources Migration - Migrate SEPA saved payment methods
- Deprecate Key Sharing - Webhook setup via API HOT 1
- Deprecate Key Sharing - Add OAuth re-connect flow
- Deprecate Key Sharing - Add Stripe App re-connect flow
- [Cash App] Display a warning for transactions above 2000 USD
- [Cash App] Update statement descriptor preview description
- Products with custom product types will be added with price 0 to the cart when using the Apple Pay button HOT 1
- Payment Processing Issues with Stripe on Website - Not reflecting on orders HOT 1
- Invalid token error when saving payment method on checkout prevents redirecting to order received page HOT 1
- Rate limit the webhook set up request so users don't click the button and send multiple requests.
- Getting a lot of blocked payments from customer due to high risk[CVC check Unavailable Street check Unavailable Zip check Unavailable] HOT 1
- Cannot manually enter account keys on live sites HOT 8
- Custom order statuses not working HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from woocommerce-gateway-stripe.