#kawuss

1 messages · Page 1 of 1 (latest)

ivory bluffBOT
clear talon
#

Hi 👋 can you elaborate on what you mean when you say you have feedback?

worthy ridge
#

I have problem with feedback when I pay used create link payment stripe

clear talon
#

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.

clear talon
worthy ridge
#

I would like to when I pay in this link I want to message in my command in java

clear talon
#

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.

worthy ridge
#

This is this beckend

clear talon
#

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?

worthy ridge
#

I trying get feedback this code

#

that's everything

clear talon
#

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?

worthy ridge
#

I want the code to return to the console after the payment is successful

clear talon
#

Cool, looks like it should do that.

worthy ridge
#

how ?

clear talon
#

It has println statements, that's how it prints to the console.

worthy ridge
#

But when I payment succesfull it don't return me this messege

clear talon
#

Are you still running stripe listen --forward-to?

worthy ridge
#

yes

clear talon
#

Is it forwarding the Event to your local endpoint?

worthy ridge
worthy ridge
clear talon
#

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 "";
 }```
worthy ridge
#

Where I must paste this code ?

clear talon
#

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 "";
 }```
worthy ridge
#

Why my code give me 400 code not 200 code ?

clear talon
#

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.

worthy ridge
#

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

clear talon
worthy ridge
#

so how I can chenge this and solving my problem ?

clear talon
#

Not sure yet, is the time on your local machine set and accurate?

worthy ridge
#

so when I chenge my localtime on my computer that application work ?

clear talon
#

Maybe, maybe not. Is it set accurately now? If it's accurate now, then that likely isn't the cause of the issue.

worthy ridge
#

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]

ivory bluffBOT
clear talon
#

Alright, so that's one issue down, now your server is responding with a 500 which typically indicates the code crashed.

worthy ridge
#

how I can repair this code ?

clear talon
#

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.

worthy ridge
#

so what I must add to my code ?

acoustic oak
#

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.

worthy ridge
#

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]

acoustic oak
#

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

worthy ridge
#

How I can chenge it

#

How I can mode it ?

acoustic oak
#

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

worthy ridge
acoustic oak
#

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

worthy ridge
#

Ok thanks for your help

acoustic oak
worthy ridge
acoustic oak
#

~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

worthy ridge
#

That is only code in my scripe application

acoustic oak
#

When you say you changed API versions, how did you change them?

worthy ridge
#

I add on my maven this dependency <dependency>
<groupId>com.stripe</groupId>
<artifactId>stripe-java</artifactId>
<version>22.29.0</version>
</dependency>

acoustic oak
#

And then rebuilt your project?

worthy ridge
#

Yup

#

so how I can fix my error ?

acoustic oak
#

And when does this error get thrown?

worthy ridge
#

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]

acoustic oak
#

Hmmm ... 🤔

acoustic oak
#

If you go back to using our Java webhook builder code, do you get the same errors?