#one-love_webhooks

1 messages ยท Page 1 of 1 (latest)

random kestrelBOT
#

๐Ÿ‘‹ 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/1216621557749776404

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

ancient tokenBOT
#

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.

grim latch
polar hare
#

With the sample code what should I be seeing in the response? When I click on the Webhook tab and click on the webhook url - to the right there is a response that states.

#

HTTP status code
200 (OK)

โš ๏ธ Webhook error while validating signature.

#

What does that mean?

#

Isn't correct validation of the signature important?

#

It states this error on all of my attempts.

#

I'm assuming the 200(ok) is coming from the last line of the sample code, but the error, I have no idea.

grim latch
#

"When I click on the Webhook tab and click on the webhook url" Which page do you refer to here?

polar hare
#

The link you sent is a checkout.session.complete event. I've been sending payment_intent.succeeded events when I see the error.

#

The page I am referring to is in the Developers section of dashboard. Which shows my webhook url in big bold type. If I click on that it shows different requests. The requests show the error I've mentioned.

grim latch
#

Alright, can you share the exact event id you are seeing there?

polar hare
#

There are only payment_intent.succeeded events there

grim latch
#

Yes but you provided evt_1Ot1KVIIYLWrOwdxHavqco04 which isn't there

polar hare
#

Sorry. I'll look again.

grim latch
#

No worries. Anyway evt_1Ot1KVIIYLWrOwdxHavqco04 is a checkout.session.completed which is not handled by your webhook endpoint. Your webhook endpoint only listen to payment_intent.succeeded

polar hare
#

evt_3Ot1KTIIYLWrOwdx1F7s2Yhk

#

there is the correct evt. What is the best event I should listen for - to confirm a one time payment?

grim latch
#

Alright this one is a payment_intent.succeeded LGTM

#

If you are using Checkout, then checkout.session.completed is correct

polar hare
#

I'll change my event listener to checkout.session.complete. Shouldn't payment_intent.suceeded work also?

grim latch
#

Yes it should, but it will also be sent for transactions not via Checkout

polar hare
#

You don't see a problem. Should I delete my old webhook url with payment intent event - and create a new one with checkout.session.complete?

grim latch
#

Can you just update the endpoint to include the new event type?

polar hare
#

I don't see a section to update. I deleted and recreated it. Just testing it now. I'll send you the evt

#

I received the same error using checkout.session.completed. The evt is evt_1Ot2CFIIYLWrOwdxyEGRVlCt

grim latch
#

Okie I see it returns 200 which is fine to Stripe. Your server somehow also outputted Webhook error while validating signature.

#

Did your code output that somewhere?

polar hare
#

I didn't code that message.

grim latch
#

Can you share your code>?

polar hare
#

how do I do that? Just cut and paste it? Isn't there a character limit?

grim latch
#

You can try

#

Here, using Markdown editor

polar hare
#

I'm new to discord. Where is Markdown editor?

grim latch
#

Yeah checking

#

Alright looks good though. Can you add some debug here to see where did it go?

#

ie. after $event = \Stripe\Webhook::constructEvent to see how $event looks like

polar hare
#

I'm testing on a live site

#

I'm not testing locally

grim latch
#

Also when this is checkout.session.completed, then $event->data->object won't likely be a PaymentIntent anymore

#

What do you mean? You should make sure your code runs well in Test environment first

polar hare
#

I figured that, but that wouldn't cause the error. I'll comment it out, and try again. $paymentIntent is only the variable name.

#

$event->data->object doesn't change does it?

#

Do you see anything else wrong with this sample code.

#

Will it connect to my localhost? Do I have to change any settings for it to connect to localhost?

#

My site is in test mode.

#

Are you there?

grim latch
#

Yes but sorry the last few sentences didn't make sense. I would say you want to test this code on your localhost first, and use the forward command on Stripe CLI to test it before deploying to a server

#

But sure it's up to you to test directly in the server, it would just be difficult in compare to testing in local

#

Just add some log

polar hare
#

I'm new to CLI and the forward command. Are there instructions for testing locally?

grim latch
polar hare
#

I was using friendly-url settings in my htaccess file. It may be working now. Can you check this evt_3Ot2m9IIYLWrOwdx0rw2SuJZ

grim latch
#

It looks like succeded after a few retries

polar hare
#

I think it's working. I'm having problems finding syntax examples for getting the returned values from the payment intent. Is there documentation showing the syntax? Is this XML?

grim latch
#

It's in JSON ๐Ÿ™‚