-
Notifications
You must be signed in to change notification settings - Fork 355
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
JsonMappingException exception is throwing when retrieving a customer #496
Comments
Hi @nomadus. I think this issue is caused by the addition of the The library uses Gson as its JSON library, and using You can go with your rewritten method, or alternatively you can configure Jackson to ignore transient fields with |
…; need to find a different fix for stripe (stripe/stripe-java#496)
is this issue resolved yet ? I am getting the same exception just for passing ChargeCreateParams object to the charge.create() method. it works fine if I put spring.jackson.mapper.propagate-transient-marker=true in the properites file. |
Hi @dagetachew. I don't think this issue can be solved from the stripe-java library. stripe-java uses Gson as its JSON library, not Jackson, so we cannot ensure that Stripe objects will play nicely with Jackson. The proper way to fix this would be to never use Jackson to serialize or deserialize Stripe objects from/to JSON. You can use the following methods provided by the library instead: // deserialization
Customer customer = APIResource.GSON.fromJson(json, Customer.class);
// serialization
String serialized = customer.toJson(); If you absolutely have to use Jackson, then setting |
Thanks for this. My team is spiking out a Stripe solution with Spring and this info was very helpful. |
The code was working with an older stripe version 3.5.0 library, but with the newest library it throws:
Here is the code pieces:
In the serviceImpl class I retrieve Customer object via
customer = Customer.retrieve(currentAccount.getCustomerStripeId());
In the controller class:
This piece of code throws above error. When I re-write the method as below:
The customer is returned with no issues. What have changed in the library? Do I have to re-write my code base as above?
The text was updated successfully, but these errors were encountered: