#ferret13_webhooks
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1306796163369799710
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- ferret_paymentintent-integration, 1 hour ago, 32 messages
- ferret13_api, 17 hours ago, 9 messages
Hi, could you try to download the full example from our Quickstart Doc and run? https://docs.stripe.com/webhooks/quickstart
So the code on the following link is incorrect?
It is correct, but it could depends on your environment / framework settings. It's easier to just try a downloaded full project
Yes, I am using Java but it's Spring Boot and the example is play Java
Change my code to reflect the link you sent me and same errors
Can you simply just use the example and Play to test your accout first?
The code is verbatim from the example just minor difference to suit Spring Boot
webhook errors
That's the most common errored part
The json variable your are taking
vs the request.body() from the example code, is different
Spring Boot uses @RequestBody which is same thing
The most common error in webhook is your web framework trying to modify the incoming content (via a middleware or setup in the framework) and it has changed
And that's specific to SpringBoot
This code has worked for past 4-5 years without an issue, the only thing we are changing is to get PaymentIntent instead of Session
Can you show the exact diff you made?
switch (event.getType()) should be after doing the getObject().isPresent()
The following is failing;
aymentIntent paymentIntent = (PaymentIntent) eventDataObjectDeserializer.getObject().get();
error with requestbody
webhook with successes
Okie but on your server log, what do you get?
Do you get the "Unable to deserialize ...."
Yes, below is the explanation;
nested exception is java.lang.IllegalStateException: Unable to deserialize event data object for <com.stripe.model.Event@1448259402 id=evt_3QLFePBaABhl7ASC1aWxqcLX> JSON: {
Can you try to move the ...getObject().get() to above the switch, and then in switch case, start to cast to each type of object
exactly like the sample code
And see how Checkout Session works vs. PaymentIntent
Already did this and every deserialization fails pls refer back to image for Webhook where I got all event object were 500's
I am pretty dumb with this stuff but if i didnt know better i would say its a library issue in our pom.xml
I too don't get that's different for your Checkout Session
can you share the code when you did that?
screenshots and webhook function
Here is the spring boot console log
Okie move back to the code where it works, then log out eventDataObjectDeserializer.getObject() before and after the switch
to see how it value changes there
Now we are seeing it has isPresent() is true before the swtch but false inside the switch
I am sorry, running out of idea. Just some general debugging curiousity
Will do, can you pls leave thread open?
Will open until we change staff. But don't worry, my colleague can always see the past threads
Nothing is working now since we update com.google.code.gson from 2.8.9 to 2.11.0
java.lang.IllegalStateException: Unable to deserialize event data object for charge.succeeded
java.lang.IllegalStateException: Unable to deserialize event data object for payment_intent.succeeded
java.lang.IllegalStateException: Unable to deserialize event data object for payment_intent.created
java.lang.IllegalStateException: Unable to deserialize event data object for charge.updated
Even with the Check Session and the old working code?
I think that's the library and SpringBoot settings
that modified the json content
Spring Boot (@RequestBody String json) don't be confused with my naming of json it can be named anything even "payload" the DataType is String.
Hello! stepping in to take over from orakaro.
Thanks Alex
I noticed that in testmode, you're using stripe-java 26.5.1 . This is pinned to the Stripe API version 2024-06-20
Now, it looks like you are using the Stripe CLI to forward events on to your local webhook endpoint. The Stripe event API version is 2020-08-27.
With our strongly-typed libraries each library version is pinned to a specific Stripe API version - so if your webhook event is using a different API version than your library, it will have trouble deserializing the object.
It's unfortunate, but the Stripe CLI will always use your Stripe account's default API version which is currently 2020-08-27 for sending webhook events. You might want to setup a webhook endpoint to explicitly use the API version 2024-06-20, and use a service like ngrok to forward the webhook events to your endpoint, and see if you are still running into the same issue
You need to use the API to create a webhook endpoint with a specific API version, you can't do it via the Dashboard : https://docs.stripe.com/api/webhook_endpoints/create#create_webhook_endpoint-api_version
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Yes, I was using Stripe 20.87.0 & Gson 2.8.9, I update version to work with new API feature although in the end we're not using that feature now, so will roll back to previous versions and re-test
After rolling back versions the deserialization is working correctly.
I did mention to Orakaro that my gut feeling it was a library versioning issue.
We now need top retest Intent Setup API
<dependency>
<groupId>com.stripe</groupId>
<artifactId>stripe-java</artifactId>
<version>20.87.0</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.9</version>
</dependency>
Everything is now working as it should.
Are you able to point us to the documentation "how to update API version being using in the portal"?
sorry, which portal specifically?
Stripe Portal as our default is currently 2020-08-27
Sorry found it;
I wouldn't update your default API version immediately. It's going to affect your existing webhook endpoints cause it uses your default account API version.
Is there a documented process?
You might want to take a look at this guide : https://docs.stripe.com/webhooks/versioning