#TazI1I-webhooks

1 messages ยท Page 1 of 1 (latest)

unborn vessel
#

๐Ÿ‘‹ happy to help

#

what is the error you're getting?

alpine nexus
#

Hi @unborn vessel

#

The response code is just "ERR"

#

but in my php file

#

case 'customer.subscription.updated':
$customerSubUpd = $event->data->object; // contains a \Stripe\PaymentIntent
http_response_code(200);

unborn vessel
#

how are you testing your code? using Stripe-cli?

alpine nexus
#

I'm not using stripe-cli , My application is live

#

i set my link to access to my webhook/endpoint.php

unborn vessel
#

oh ok do you have an event id evt_xxx I could look at?

alpine nexus
#

"id": "evt_1L8L2FE37gDY06V3XuZLOFfL",

#

sure

unborn vessel
#

I'm looking at it

alpine nexus
#

stripe tells me that the delivery has failed but my url is still accessible

unborn vessel
#

it seems there's an issue with the validation of the signature

#

could you please share the whole webhook code?

#

are you using the official Stripe PHP library?

alpine nexus
#

yes, i use the official library

#

I installed the library with composer

unborn vessel
#

I'm taking a look

#

what version of the library are you using?

alpine nexus
#

i use this sample guy

unborn vessel
#

there are some differences that might be causing your issue

alpine nexus
#

{
"require": {
"stripe/stripe-php": "^7.31.0",
"vlucas/phpdotenv": "^5.3"
}
}

unborn vessel
#

mainly this try { $event = \Stripe\Event::constructFrom( json_decode($payload, true) ); } catch(\UnexpectedValueException $e) { // Invalid payload echo 'โš ๏ธ Webhook error while parsing basic request.'; http_response_code(400); exit(); }

alpine nexus
#

I will comment this block

#

I have the same error when ordering the block, I will use the example you sent me to test

unborn vessel
#

let's check your $endpoint_secret maybe it's not the correct one

#

I just checked it is correct

alpine nexus
#

it's correct because for deleted subscription is OK

unborn vessel
#

what changed in between?

alpine nexus
unborn vessel
#

it seems that some of the events are passing while others are failing and it all started on the first of june

alpine nexus
#

Yes indeed because I test, I restart my servers

#

but now everything is started and accessible

#

now for event deleted is 200 ok

#

I will try to put a line of return code in the case

unborn vessel
#

could you please try to copy paste the code in the guideline without changing anything in it and try to test it locally first?

alpine nexus
#

i resolved guy

#

it's not simple

#

to understand

#

when i put an echo in this case and with return code 200 is work

#

switch ($event->type) {
case 'customer.subscription.updated':
$customerUpdate = $event->data->object; // contains a \Stripe\PaymentIntent
echo 'Received customer subscription update' . $event->type;
http_response_code(200);

#

I have the impression that if there is no feedback the webhook goes into error automatically

unborn vessel
#

oh that might be the issue yes

alpine nexus
#

I think so, but it's not easy to debug

#

because the webhook just said "ERR"

unborn vessel
#

yes I agree

#

let me know if you need any more help

alpine nexus
#

it would be nice to make a 200 return code but empty

#

In the end it was a rather simple but twisted mistake
Thank you for your help

#

hello from france

#

I will continue to develop my code thanks

unborn vessel
#

We're here to support you whenever you need us ๐Ÿ™‚

alpine nexus
#

you will know the problem for another person ๐Ÿ˜‰

#

Good luck , bye !

unborn vessel
#

what seems to be the issue now?

alpine nexus
#

it's the same issue ...

#

but i change nothing ^^

#

switch ($event->type) {
case 'customer.subscription.created':
$customerCreate = $event->data->object; // contains a \Stripe\PaymentIntent
echo 'Received create event type ' . $event->type;
http_response_code(200);
break;
case 'customer.subscription.deleted':
$customerDelete = $event->data->object; // contains a \Stripe\PaymentIntent
echo 'Received delete event type ' . $event->type;
http_response_code(200);
break;
default:
echo 'Received unknown event type ' . $event->type;
}

#

delete is OK no problem

#

create is in error

#

but it's the same code ^^

#

it's annoying because I don't understand why it fails

#

it's strange delete don't work now

fresh eagle
#

Hey, taking over here. Just catching up

alpine nexus
#

Hi guy, no problem ^^

fresh eagle
#

Looking at evt_1L8MgKE37gDY06V3pv9jm8s1, seems like there's some kind of intermittent connection issue with your webhook

alpine nexus
#

i restart manually and the webhook deleted is OK now ^^

#

I have the impression that the connection is struggling

fresh eagle
#

Yeah, seems its intermittent. Is this a local/dev server?

alpine nexus
#

i have an haproxy linux and one server apache2/php/mariadb

#

my server is not on my workstation

#

I have optical fibre

fresh eagle
#

Whatever it is, our webhooks service is having issues communicating with it:
Socket error - this often means we could not resolve the user's hostname

#

The port could be an issue, I don't know

alpine nexus
#

Oh, the name resolution is correct though

#

i have one question

#

when you send webhook to my server the ip adress source change ?

fresh eagle
#

I'm not sure I understand the Q?

alpine nexus
#

sorry I don't speak English very well with my French language
You think that the problem is not in the code, nor in your servers, but since there is an intermittent connection, the problem is in the http listening of my servers?

fresh eagle
#

Seems like there's an issue somewhere reaching your server, yep

#

There's no ongoing issues at our end that would affect this

alpine nexus
#

Oh well I hadn't looked into load balancing

#

i change one configuration of my load blancer

#

I'm going to run a lot of deletion and creation subscription test

#

It's a stupid mistake on my part

#

there was a problem with my load balancer, hence the problem with the intermittent connection

#

because i have one balancer and two http server and i develop only on one server

#

when i configure only my server http it's OK, webhook is received OUFFFF

fresh eagle
#

All sorted?

alpine nexus
#

All my test is OK ๐Ÿ˜ฎโ€๐Ÿ’จ

#

the webhooks are received by the right server, everything is fine.
Thanks for telling me the socket error

fresh eagle
#

No problem!

alpine nexus
#

I could have tried for a long time to modify the code

#

๐Ÿคฃ

#

Can I give you a note?

fresh eagle
#

Sure

alpine nexus
#

you are performing well

fresh eagle
#

Appreciate that ๐Ÿ’Œ

alpine nexus
#

i'm a self-employed contractor so it's good to have an outside opinion

fresh eagle
#

Happy to hear you find us helpful ๐Ÿ˜„

alpine nexus
#

I wish you a good day and see you soon

fresh eagle
#

you too!

alpine nexus
#

Thanks ! you can now close the discussion good luck