#ivy-java-checkout

1 messages ยท Page 1 of 1 (latest)

light gulchBOT
random edge
#

ivy-java-checkout

#

hey @scenic kite do you have a bit more details around what your code is really doing?

scenic kite
#

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

random edge
#

yeah I'm going to need a bit more details. Like what is your exact code?

scenic kite
#

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);

random edge
#

Okay so if you add a log after that line and log session.getId() it's not working?

scenic kite
#

it crashes on the last line, will add stack trace now

finite ice
#

Hi ๐Ÿ‘‹ What version of the Stripe API that you are using?

scenic kite
#

Hi, it's Stripe java 20.32.0

finite ice
#

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?

random edge
#

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

scenic kite
#

ow, I'm not sure

#

is this it?

#

I have a log there, it never reaches that line

random edge
#

Which version of the Google GSON library are you using?

scenic kite
#

2.9.1

random edge
#

Can you easily debug this with a debugger to try and figure out what's happening in that GSON library?

scenic kite
#

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

random edge
#

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

scenic kite
#

will try to do

random edge
#

I think there are multiple getAdapter right?

scenic kite
#

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

random edge
#

yeah we want the not session ones specifically

#

your version of stripe-java is from almost 2 years ago

scenic kite
#

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?

random edge
#

things change between versions so you'd need to look at the migrations guides

scenic kite
#

thank you for your help ๐Ÿค—