#ivy-java-checkout
1 messages ยท Page 1 of 1 (latest)
ivy-java-checkout
hey @scenic kite do you have a bit more details around what your code is really doing?
I have a Java app with Stripe java
<dependency> <groupId>com.stripe</groupId> <artifactId>stripe-java</artifactId> <version>20.32.0</version> </dependency>
build with maven. My controller creates checkout session using test api key and bunch of parameters.
When I try to do this, create() method in Session session = Session.create(params); returns error above. I debugged it and saw that http call to stripe returned session json, but it can't be parsed to Session object. All this happens inside create() method which is a part of Stripe java library so I can't fix the issue myself. Previously I used earlier java version and it worked fine so now I think it might be related to java version of my project but not sure.
This is more related to Stripe java library because API worked fine here
yeah I'm going to need a bit more details. Like what is your exact code?
Stripe.apiKey = apikey;
User user = createUser(checkoutDTO);
SessionCreateParams params = new SessionCreateParams
.Builder()
.setSuccessUrl(url + user.getEmail())
.setCancelUrl(url + "cancel")
.addPaymentMethodType(SessionCreateParams.PaymentMethodType.CARD)
.setMode(SessionCreateParams.Mode.SUBSCRIPTION)
.setCustomerEmail(user.getEmail())
.addLineItem(new SessionCreateParams.LineItem.Builder()
.putExtraParam("price", checkoutDTO.getPrice())
.setQuantity(1L)
.build()
)
.build();
Session session = Session.create(params);
Okay so if you add a log after that line and log session.getId() it's not working?
Hi ๐ What version of the Stripe API that you are using?
Hi, it's Stripe java 20.32.0
I noticed that but this corresponds to a specific Stripe API version. Do you happen to know which API version is set on your account?
the API version on their account shouldn't matter here
not unless the crash happens elsewhere, hence why I asked for a log right after that line
Which version of the Google GSON library are you using?
2.9.1
Can you easily debug this with a debugger to try and figure out what's happening in that GSON library?
i tried, it seemed that it was trying to figure out adapter for Session class and failed
but can try to do more detailed one
yeah one of the maintainers of stripe-java is asking what type is for com.google.gson.Gson.getAdapter that you have in your callstack if that's something you can look at
I think there are multiple getAdapter right?
it's iterating over adapter factories ( around 50 something), among them I can't find anything related to session, threre're some stripe ones, but none for session
yeah we want the not session ones specifically
Does it happen if you try the most recent version of stripe-java? We're thinking it could plausibly be an old bug we fixed last year: https://github.com/stripe/stripe-java/pull/1197
your version of stripe-java is from almost 2 years ago
or use an earlier version of Java which allows reflection I guess ๐ค
that must be the issue I'm facing
will try later version of stripe
do you know if my code will be compitable with new version?
things change between versions so you'd need to look at the migrations guides
thank you for your help ๐ค