#rodney_api
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/1328608279265280073
đ 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.
- rodney_api, 4 days ago, 20 messages
- rodney_api, 6 days ago, 11 messages
Hi! Looking into your query.
Thank you for waiting! Can I check if you are using the right Java SDK version that is compatible with the webhook event Stripe API version?
Additionally, do you have a sample event ID I can look at?
hey thanks!
We're using com.stripe:stripe-java:25.13.0
evt_1QgxECHu5QhcXEGNdBbo8E9j is an event with the previous_attributes object
we currently cast the incoming StripeObject to the associated object for the event, so for example:
fun handleCustomerSubscriptionUpdated(
event: Event,
stripeObject: StripeObject,
): CompletableFuture<Boolean> {
val subscription = stripeObject as Subscription
for customer.subscription.updated
Hi @raven blade I'm Jack, and I'm also an engineer at Stripe
Can you share with me the code that you wrote to deserialize the webhook event?
I believe this is direct from the docs:
// Deserialize the nested object inside the event
val dataObjectDeserializer = event?.dataObjectDeserializer
var stripeObject: StripeObject?
// Deserialization failed, probably due to an API version mismatch.
// Refer to the Javadoc documentation on `EventDataObjectDeserializer` for
// instructions on how to handle this case, or return an error here.
if (dataObjectDeserializer?.getObject()?.isPresent == true)
stripeObject = dataObjectDeserializer.getObject().get()
else
throw ResponseStatusException(
HttpStatus.BAD_REQUEST,
"â ď¸ Webhook error while validating signature.\n",
)
for the event we use this right above:
val event: Event? =
try {
Webhook.constructEvent(payload, sigHeader, endpointSecret)
} catch (e: SignatureVerificationException) {
// Invalid signature
logger.info("â ď¸ Webhook error while validating signature.")
throw ResponseStatusException(
HttpStatus.BAD_REQUEST,
"â ď¸ Webhook error while validating signature.\n",
)
}
OK, when you call previousAttributes() on the deserialized event object , the function returns an empty map?
there isn't a built-in previousAttributes field on the Subscription object, so to access i'd have to get the raw json and go from there. Which would be fine, but I can't find much/any info on that object
I assume it's used internally to drive the dashboard event descriptions since they tend to be a lot more descriptive about what has changed on the subscription and I'm interested in doing something along those lines. Right now we only know what has changed if we happen to store the changed field in our db somewhere which isn't ideal and ends up being a bit of a guessing game when implementing new subscription types/features in our code