#greenlane-otavio_code
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/1283718281982640150
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
I am working with Kotlin and Stripe Java API version 26.10.0 for webhook event handling. When trying to deserialize the event object using Gson, I encounter an IllegalStateException related to a nested JSON object. I need assistance in resolving this issue.
fun receiveStripeWebhook(eventRequest: EventRequest) { logger.debug("Received Stripe webhook: {}", eventRequest) val dataJson = Event.GSON.toJson(eventRequest.data) val event = Event.GSON.fromJson(dataJson, Event::class.java) }
java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 12 path $.object
JSON Data:
{ "object":{ "id":"pm_1PxUhD1njmFqhzphnnxaX5Hf", "object":"payment_method", "allow_redisplay":"unspecified", "billing_details":{ "address":{} }, "card":{ "brand":"visa", "checks":{ "cvc_check":"pass" }, "country":"US", "display_brand":"visa", "exp_month":9, "exp_year":2025, "fingerprint":"5HEtFZvMGkYtkqh2", "funding":"credit", "last4":"4242", "networks":{ "available":[ "visa" ] }, "three_d_secure_usage":{ "supported":true } }, "created":1725977131, "customer":"cus_Qp8z2VBEMbfUc1", "livemode":false, "metadata":{}, "type":"card" } }
Have you faced any issues like this using Kotlin with your API?
I am following the Stripe webhook documentation here: Stripe Webhooks Documentation
๐
What is your API version of your webhook endpoint ?
Can you share an eventId ?
we_1PxUYN1njmFqhzphBRngCD0D
Event ID: https://dashboard.stripe.com/test/workbench/events/evt_1Pxol61njmFqhzphBEhuq096
API version 2024-06-20
Thanks for sharing these additional details
I encounter an IllegalStateException related to a nested JSON object
Can you share a complete Stacktrace ?
Have you tried to pull and run the official Quickstart Java project?
https://docs.stripe.com/webhooks/quickstart?lang=java