#Att89
1 messages ยท Page 1 of 1 (latest)
Hi! Let me help you with this.
Hi! Thanks, the ID of our account is acct_1M1mEbDXxFAIpgi2
The last event triggered locally, which failed has the ID evt_3MCJjEDXxFAIpgi20Hn2gAhm
In Test-mode but not locally:
evt_3MCJjEDXxFAIpgi20phB6RMs
And in Live-Mode:
evt_1MC5nzDXxFAIpgi2TZxYkCJg
Hopefully it is the same problem though
Looking at it
It seems like the error is happening inside your server. Are you getting any errors on your side?
Locally nothing, in our test-server sometimes this error:
com.stripe.exception.PermissionException: Only Stripe Connect platforms can work with other accounts. If you specified a client_id parameter, make sure it's correct. If you need to setup a Stripe Connect platform, you can do so at https://dashboard.stripe.com/account/applications/settings.; code: platform_account_required
But I don't now what this even mean
It doesn't seem to be related to webhooks.
You mean the error above? I think it is probably because of the move of the data from the old account.
Your server is responding with status 400 to Stripe attempts to send a webhook request. You need to check if the webhook endpoint address is correct, and check why does your server respond with 400 error.
When does this error occur?
For example on a login of a user, I will check what the server does with the stripe account, but it has nothing to do with the webhook-problem
I think at least
I check first the webhook-addresses one more time
Hmm, the webhook entpoint address and secret key for stripe is set properly
If I open the address from the console, where Stripe CLI is running, the server is triggered
Can you confirm that the server is receiving and handling any webhook request? For example, by logging a message?
The endpoint secret for local testing should be the one displayed in the console, after running the command
stripe listen --forward-to *address*
am I right?
Yes
I'm going to log the two cases, where the server gives 400 back
OK, the error happens on the deserialization of the stripe object
Therefore I use the standard stripe code-snippet before the switch-case statement for handling the event, to deserialize the stripeobject
For some reason the dataObjectDeserializer.getObject().isPresent() is false, and dataObjectDeserializer.getObject() has the value Optional.empty
So basically the data coming in is empty
๐ taking over for my colleague. Let me catch up.
Hello
would you mind sharing your code please?
yes please
I use the stripe standard code snippet from setting up the webhook:
Event event = null;
// Verify webhook signature and extract the event.
// See https://stripe.com/docs/webhooks/signatures for more information.
try {
event = Webhook.constructEvent(payload, header, ENDPOINT_SECRET);
} catch (JSONException | SignatureVerificationException e) {
// Invalid payload or signature
response.setStatus(400);
return "";
}
EventDataObjectDeserializer dataObjectDeserializer = event.getDataObjectDeserializer();
StripeObject stripeObject;
if (dataObjectDeserializer.getObject().isPresent()) {
stripeObject = dataObjectDeserializer.getObject().get();
} else {
// 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.
response.setStatus(400);
return "";
}```
The error happening below, beacuseif (dataObjectDeserializer.getObject().isPresent()) is false
If I print out dataObjectDeserializer.getObject(), it has the value Optional.empty
ok could you please log the event after this line:
event = Webhook.constructEvent(payload, header, ENDPOINT_SECRET);
One second please, I also check the API version
could you also log the payload?
what version of the Java SDK are you using?
In the dashboard 2022-08-01 is set
The Java SDK Version is 20.120.0
This is the one I used on our old account
you need to update to v.21.x
each Java SDK major version is bound to a Stripe API version
meaning that the 20.x is pinned to API version 2020-08-27
while the version 21.x is pinned to API version 2022-08-01
https://github.com/stripe/stripe-java/blob/master/CHANGELOG.md#2100---2022-08-02
and version 22.x is pinned to API version 2022-11-15
https://github.com/stripe/stripe-java/blob/master/CHANGELOG.md#2200---2022-11-16
OK, changed the version to 21.15.0
could you rerun your tests?
A newer version has some major changes, as i saw
yes exactly
If I would use it, i must make also some major changes on our server
How long is 21.15.0 supported?
As I saw some functions, which I need and use now, doesn't even exists any more
v21.x is still a supported and very widely used version since API version 2022-08-01 hasn't been around for a long while
OK, so I don't have to worry for a while?
there will be updates on v21 for sure (e.g. there's a v21.16.0-beta.1) so keep an eye on the changelog to know when you might be interested in updating minor versions
and you wouldn't need to change the major version unless you are planning on upgrading the API version from your dashboard
you might be interested in upgrading your Stripe API version if you see features in the changelog(https://stripe.com/docs/changelog) that you would benefit from