Skip to content
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

Explicitly Expose iDEAL Errors when creating iDEAL source #792

Closed
utwyko opened this issue Jan 31, 2019 · 3 comments
Closed

Explicitly Expose iDEAL Errors when creating iDEAL source #792

utwyko opened this issue Jan 31, 2019 · 3 comments
Assignees

Comments

@utwyko
Copy link

utwyko commented Jan 31, 2019

The documentation on [iDEAL error codes] mention three specific iDEAL errors that should be handled in certain ways. For example, payment_method_not_available should invite the customer to use another payment method.

From what I see, Stripe.createSourceSynchronous() throws four possible exceptions:

  • AuthenticationException
  • InvalidRequestException
  • APIConnectionException
  • APIException

I don't think any of these expose the iDEAL errors except for maybe an error message.

Is there a proper way to check if any of these specific iDEAL errors occurred? And if not, would it be possible to add these?

@mshafrir-stripe
Copy link
Collaborator

@utwyko thanks for filing this issue. I will add a StripeError field to StripeException, so that you can access StripeError.code, which will tell you the error code (e.g. "payment_method_not_available").

@mshafrir-stripe mshafrir-stripe self-assigned this Jan 31, 2019
mshafrir-stripe added a commit that referenced this issue Jan 31, 2019
**Summary**
Add a `StripeError` field to `StripeException`.
Access via `StripeException#getStripeError()`

**Motivation**
The error code is an important field for SDK users
to be able to determine why a request failed, and
allows them to better react to the failure.

For example, a `"payment_method_not_available"` code
may suggest to the developer to invite a customer to
use another payment method. Additionally, a developer
may choose to localize an user-facing error based on
this code.

Fixes #792

**Testing**
Wrote automated tests.
mshafrir-stripe added a commit that referenced this issue Jan 31, 2019
**Summary**
Add a `StripeError` field to `StripeException`.
Access via `StripeException#getStripeError()`

**Motivation**
The error code is an important field for SDK users
to be able to determine why a request failed, and
allows them to better react to the failure.

For example, a `"payment_method_not_available"` code
may suggest to the developer to invite a customer to
use another payment method. Additionally, a developer
may choose to localize an user-facing error based on
this code.

Fixes #792

**Testing**
Wrote automated tests.
mshafrir-stripe added a commit that referenced this issue Feb 6, 2019
**Summary**
Add a `StripeError` field to `StripeException`.
Access via `StripeException#getStripeError()`

**Motivation**
The error code is an important field for SDK users
to be able to determine why a request failed, and
allows them to better react to the failure.

For example, a `"payment_method_not_available"` code
may suggest to the developer to invite a customer to
use another payment method. Additionally, a developer
may choose to localize an user-facing error based on
this code.

Fixes #792

**Testing**
Wrote automated tests.
@mshafrir-stripe
Copy link
Collaborator

@utwyko this is now available in v8.4.0

@utwyko
Copy link
Author

utwyko commented Feb 7, 2019

Thank you, that was quick 👍!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants