#kawuss
1 messages · Page 1 of 1 (latest)
Hi 👋 can you elaborate on what you mean when you say you have feedback?
I have problem with feedback when I pay used create link payment stripe
I know this is for test mode, but you should avoid sharing things that contain your secret key and webhook signing secrets. I would suggest you consider rolling that secret key.
What does that mean, what is the problem you're running into? Are you encountering an error, or is there a concern with the data you're seeing?
I would like to when I pay in this link I want to message in my command in java
I'm sorry, that doesn't help me understand what problem you're running into. I'm going to need more context on what is blocking the flow you have from doing what you want in order to be able to provide assistance.
So I create backend when I pay for something in this link https://buy.stripe.com/test_aEUcPIgtjcrMbegeV8 I want messege in my console
This is this beckend
You don't have any webhook endpoints registered for your account, so currently the Stripe CLI is the only way to listen for Events. Are you trying to stand up an actual webhook endpoint that doesn't use the CLI to receive Events?
You keep saying that, but you don't elaborate when I say I don't know what that means.
So let's pause, and focus on what you mean when you say:
I trying get feedback this code
Are you trying to get me to provide feedback to you about your code?
or
Is feedback something you're expecting your code to do that it isn't?
The code you shared looks like it will print to console when it receives an Event, is that not what you're seeing when you run that code?
I want the code to return to the console after the payment is successful
Cool, looks like it should do that.
how ?
It has println statements, that's how it prints to the console.
But when I payment succesfull it don't return me this messege
Are you still running stripe listen --forward-to?
yes
Is it forwarding the Event to your local endpoint?
idk how I can check it ?
Looks like your server is responding with a 400, which based on the code you shared is likely being returned due to a signature verificaiton issue:
// Invalid signature
response.status(400);
return "";
}```
Where I must paste this code ?
You don't need to, I copied that out of the code you provided me.
That is the part of your code that seems to be returning a 400.
Oh, actually, there is another catch block above it for a json exception:
// Invalid payload
response.status(400);
return "";
} catch (SignatureVerificationException e) {
// Invalid signature
response.status(400);
return "";
}```
Why my code give me 400 code not 200 code ?
You will want to add additional logging to your code to figure out which catch is being hit that is causing a 400 to be returned, then you'll want to investigate why that is happening.
You can probably log the exceptions after they've been caught to get more details on what they are.
when I log it I have that messege com.stripe.exception.SignatureVerificationException: Timestamp outside the tolerance zone
com.stripe.exception.SignatureVerificationException: Timestamp outside the tolerance zone
com.stripe.exception.SignatureVerificationException: Timestamp outside the tolerance zone
com.stripe.exception.SignatureVerificationException: Timestamp outside the tolerance zone
com.stripe.exception.SignatureVerificationException: Timestamp outside the tolerance zone
That happens when the difference between the timestamp on the Event and the timestamp on the local machine processing the Event are futher apart than the accepted tolerance. By default that tolerance is set to 5 minutes:
https://github.com/stripe/stripe-java/blob/a2e73d397025a64cd2159a4a30bacfe0f3cf804d/src/main/java/com/stripe/net/Webhook.java#L15
so how I can chenge this and solving my problem ?
Not sure yet, is the time on your local machine set and accurate?
so when I chenge my localtime on my computer that application work ?
Maybe, maybe not. Is it set accurately now? If it's accurate now, then that likely isn't the cause of the issue.
and in the command this error 2023-07-28 17:40:36 --> payment_intent.created [evt_3NYsmMLy95EblZpM1szsvsV7]
2023-07-28 17:40:36 <-- [200] POST http://localhost:4242/webhook [evt_3NYsmMLy95EblZpM1pXvebaZ]
2023-07-28 17:40:36 <-- [200] POST http://localhost:4242/webhook [evt_3NYsmMLy95EblZpM1szsvsV7]
2023-07-28 17:40:47 --> payment_intent.succeeded [evt_3NYsmMLy95EblZpM1p9fslvz]
2023-07-28 17:40:47 <-- [500] POST http://localhost:4242/webhook [evt_3NYsmMLy95EblZpM1p9fslvz]
2023-07-28 17:40:48 --> charge.succeeded [evt_3NYsmMLy95EblZpM1BYPc3KL]
2023-07-28 17:40:48 <-- [200] POST http://localhost:4242/webhook [evt_3NYsmMLy95EblZpM1BYPc3KL]
2023-07-28 17:40:48 --> checkout.session.completed [evt_1NYsmZLy95EblZpMLzzF8ouP]
2023-07-28 17:40:48 <-- [200] POST http://localhost:4242/webhook [evt_1NYsmZLy95EblZpMLzzF8ouP]
2023-07-28 17:42:31 --> payment_intent.requires_action [evt_3NYsoELy95EblZpM1wZZ3jRF]
2023-07-28 17:42:31 --> payment_intent.created [evt_3NYsoELy95EblZpM1QypYaTJ]
2023-07-28 17:42:31 <-- [200] POST http://localhost:4242/webhook [evt_3NYsoELy95EblZpM1wZZ3jRF]
2023-07-28 17:42:31 <-- [200] POST http://localhost:4242/webhook [evt_3NYsoELy95EblZpM1QypYaTJ]
2023-07-28 17:42:40 --> payment_intent.succeeded [evt_3NYsoELy95EblZpM1N7oG4wt]
2023-07-28 17:42:40 <-- [500] POST http://localhost:4242/webhook [evt_3NYsoELy95EblZpM1N7oG4wt]
2023-07-28 17:42:40 --> charge.succeeded [evt_3NYsoELy95EblZpM1N9p9nrW]
2023-07-28 17:42:40 <-- [200] POST http://localhost:4242/webhook [evt_3NYsoELy95EblZpM1N9p9nrW]
2023-07-28 17:42:41 --> checkout.session.completed [evt_1NYsoOLy95EblZpMqJJsq25j]
2023-07-28 17:42:41 <-- [200] POST http://localhost:4242/webhook [evt_1NYsoOLy95EblZpMqJJsq25j]
Alright, so that's one issue down, now your server is responding with a 500 which typically indicates the code crashed.
how I can repair this code ?
You have this section which populates stripeObject:
StripeObject stripeObject = null;
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.
}```
But then later when you try to reference `stripeObject` to populate `paymentIntent`, you don't make sure it isn't `null` first:
```switch (event.getType()) {
case "payment_intent.succeeded": {
PaymentIntent paymentIntent = (PaymentIntent) stripeObject;
System.out.println("Sukces płatności! ID płatności: " +
paymentIntent.getId());
break;
}```
Which seems to align with the error being printed to your console:
```java.lang.NullPointerException: Cannot invoke "com.stripe.model.PaymentIntent.getId()" because "paymentIntent" is null```
This is your code, you should be able to debug it.
so what I must add to my code ?
Hi 👋
My colleague @clear talon needs to step away so I'm taking over
However, I can't advise you on what to add to your code specifically.
I would recommend you include more logging statements to verify the objects you are referencing exist and have the values you expect.
Now my code return me code 404 2023-07-28 17:54:31 <-- [200] POST http://localhost:4242/webhook [evt_1NYszrLy95EblZpMnEWlCLfi]
2023-07-28 17:57:43 --> payment_intent.requires_action [evt_3NYt2wLy95EblZpM17CjgnVN]
2023-07-28 17:57:43 --> payment_intent.created [evt_3NYt2wLy95EblZpM1Rf4FREb]
2023-07-28 17:57:44 <-- [200] POST http://localhost:4242/webhook [evt_3NYt2wLy95EblZpM17CjgnVN]
2023-07-28 17:57:44 <-- [404] POST http://localhost:4242/webhook [evt_3NYt2wLy95EblZpM1Rf4FREb]
2023-07-28 17:57:55 --> payment_intent.succeeded [evt_3NYt2wLy95EblZpM17FmLMSH]
2023-07-28 17:57:55 <-- [200] POST http://localhost:4242/webhook [evt_3NYt2wLy95EblZpM17FmLMSH]
2023-07-28 17:57:56 --> charge.succeeded [evt_3NYt2wLy95EblZpM1L12X8HW]
2023-07-28 17:57:56 <-- [404] POST http://localhost:4242/webhook [evt_3NYt2wLy95EblZpM1L12X8HW]
2023-07-28 17:57:56 --> checkout.session.completed [evt_1NYt3ALy95EblZpMy1EGClFk]
2023-07-28 17:57:56 <-- [404] POST http://localhost:4242/webhook [evt_1NYt3ALy95EblZpMy1EGClFk]
I did notice that your account has a default API version set to 2022-11-15 but the version of our Java client library you are using pins the API version to 2022-08-01
Since the stripe listen command only lets you listen to webhook events using the current API version you may need to update your stripe-java version
You would need to update your stripe-java version
You change it the same way you change any of the package dependencies in your Java system
I can't give you advice on this. I'm not familiar with managing Java applications.
As a developer, you need to know how to handle this
Ok thanks for your help
It looks like you got started with our code here: https://stripe.com/docs/webhooks/quickstart?lang=java
Once you have the stripe version worked out ( see here https://github.com/stripe/stripe-java), then I recommend you add logging in the else block to catch what might be going wrong
When I chenge API wersjion I have that error
~I'm not seeing any Stripe related classes in that stack trace. This looks like it involves some other part of your code~
On wait there it is in constructEvent
That is only code in my scripe application
When you say you changed API versions, how did you change them?
I add on my maven this dependency <dependency>
<groupId>com.stripe</groupId>
<artifactId>stripe-java</artifactId>
<version>22.29.0</version>
</dependency>
And then rebuilt your project?
And when does this error get thrown?
When I have succesfully payment and on this log 2023-07-28 18:23:30 --> payment_intent.created [evt_3NYtRtLy95EblZpM1PDLVDME]
2023-07-28 18:23:30 <-- [500] POST http://localhost:4242/webhook [evt_3NYtRtLy95EblZpM1PDLVDME]
2023-07-28 18:23:30 <-- [500] POST http://localhost:4242/webhook [evt_3NYtRtLy95EblZpM1YmCFVWW]
2023-07-28 18:23:43 --> payment_intent.succeeded [evt_3NYtRtLy95EblZpM1gskhIt0]
2023-07-28 18:23:43 <-- [500] POST http://localhost:4242/webhook [evt_3NYtRtLy95EblZpM1gskhIt0]
2023-07-28 18:23:43 --> charge.succeeded [evt_3NYtRtLy95EblZpM1aocgQ7h]
2023-07-28 18:23:43 <-- [500] POST http://localhost:4242/webhook [evt_3NYtRtLy95EblZpM1aocgQ7h]
2023-07-28 18:23:43 --> checkout.session.completed [evt_1NYtS7Ly95EblZpMl0hnzjwA]
2023-07-28 18:23:43 <-- [500] POST http://localhost:4242/webhook [evt_1NYtS7Ly95EblZpMl0hnzjwA]
2023-07-28 18:33:55 --> payment_intent.requires_action [evt_3NYtbxLy95EblZpM1s8I1ndl]
2023-07-28 18:33:55 --> payment_intent.created [evt_3NYtbxLy95EblZpM18xvcyZN]
2023-07-28 18:33:55 <-- [500] POST http://localhost:4242/webhook [evt_3NYtbxLy95EblZpM18xvcyZN]
2023-07-28 18:33:55 <-- [500] POST http://localhost:4242/webhook [evt_3NYtbxLy95EblZpM1s8I1ndl]
2023-07-28 18:34:04 --> payment_intent.succeeded [evt_3NYtbxLy95EblZpM1wCFZhVX]
2023-07-28 18:34:04 <-- [500] POST http://localhost:4242/webhook [evt_3NYtbxLy95EblZpM1wCFZhVX]
2023-07-28 18:34:05 --> charge.succeeded [evt_3NYtbxLy95EblZpM1LJn8Ga6]
2023-07-28 18:34:05 <-- [500] POST http://localhost:4242/webhook [evt_3NYtbxLy95EblZpM1LJn8Ga6]
2023-07-28 18:34:05 --> checkout.session.completed [evt_1NYtc9Ly95EblZpMIiViNqrE]
2023-07-28 18:34:05 <-- [500] POST http://localhost:4242/webhook [evt_1NYtc9Ly95EblZpMIiViNqrE]
Hmmm ... 🤔