#SìromØne [VG0] -webhook-empty

1 messages · Page 1 of 1 (latest)

rare locust
violet comet
#

hey there

#

you should be able to get the data without a signature verification, even if this is recommended

#

ie, if you parse the json the data is there, and that doesnt depend on the signature

wet fox
#

That is strange then. The isObjectPresent returns false. When i log the event, the Json of the object is empty.

violet comet
#

which language do you use on the server?

#

have you logged the raw object body to insptead?

wet fox
#

Java

#

yes, getting now...

#

Received Stripe webhook event [payment_method.detached]:
<com.stripe.model.Event@366716663 id=evt_1Ja3tMROrXwizNyMqib5njWo> JSON: {
"account": "acct_1JPVnQROrXwizNyM",
"api_version": null,
"created": 1631734536,
"data": {
"previous_attributes": null,
"object": {}
},
"id": "evt_1Ja3tMROrXwizNyMqib5njWo",
"livemode": false,
"object": "event",
"pending_webhooks": null,
"request": {
"id": "req_DNgfDx8P9ZbJuN",
"idempotency_key": null
},
"type": "payment_method.detached"
}

#

// Deserialize the nested object inside the event
EventDataObjectDeserializer dataObjectDeserializer = event.getDataObjectDeserializer();
StripeObject stripeObject;
if (dataObjectDeserializer.getObject().isPresent()) {
stripeObject = dataObjectDeserializer.getObject().get();
} else {
logger.error("Stripe deserialization failed, raw JSON:\n{}", dataObjectDeserializer.getRawJson());
// TODO: 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.
return ResponseEntity.unprocessableEntity().build();
}

violet comet
#

ah

#

this is likely related to your stripe-java version, it needs to match the api version set on the webhook endpoint

#

which stripe-java version are you using?

#

and whats the api version of your endpoint?

wet fox
#

"com.stripe:stripe-java:20.58.0"

#

is it too old?

#

"api_version": "2020-08-27",

violet comet
#

hmm ok that should match

#

the json deserialization error is usually a mismatched api version

wet fox
#

"id": "evt_3JXntsEnrlVgo8vJ0NvlPJLx",
"object": "event",
"api_version": "2020-08-27",
"created": 1631801223,

#

I am still waiting to activate it in Production, now this API goes directly to my Test environment

#

I will try to update the library then

violet comet
#

it should not be needed since they already match, though

wet fox
#

thanks synthrider, i have to go now. I will check later.