#TazI1I-webhooks
1 messages ยท Page 1 of 1 (latest)
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);
how are you testing your code? using Stripe-cli?
I'm not using stripe-cli , My application is live
i set my link to access to my webhook/endpoint.php
oh ok do you have an event id evt_xxx I could look at?
I'm looking at it
stripe tells me that the delivery has failed but my url is still accessible
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?
I'm taking a look
what version of the library are you using?
if you're using the latest, I suggest following the guide here https://stripe.com/docs/webhooks/signatures#verify-official-libraries
i use this sample guy
there are some differences that might be causing your issue
{
"require": {
"stripe/stripe-php": "^7.31.0",
"vlucas/phpdotenv": "^5.3"
}
}
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(); }
I will comment this block
I have the same error when ordering the block, I will use the example you sent me to test
let's check your $endpoint_secret maybe it's not the correct one
I just checked it is correct
it's correct because for deleted subscription is OK
what changed in between?
it seems that some of the events are passing while others are failing and it all started on the first of june
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
could you please try to copy paste the code in the guideline without changing anything in it and try to test it locally first?
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
oh that might be the issue yes
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
We're here to support you whenever you need us ๐
what seems to be the issue now?
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
Hey, taking over here. Just catching up
Hi guy, no problem ^^
Looking at evt_1L8MgKE37gDY06V3pv9jm8s1, seems like there's some kind of intermittent connection issue with your webhook
i restart manually and the webhook deleted is OK now ^^
I have the impression that the connection is struggling
Yeah, seems its intermittent. Is this a local/dev server?
i have an haproxy linux and one server apache2/php/mariadb
my server is not on my workstation
I have optical fibre
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
Oh, the name resolution is correct though
i have one question
when you send webhook to my server the ip adress source change ?
I'm not sure I understand the Q?
Our webhook delivery attempts are to whichever URL you configure. In this case its: https://app.donnees-secure.fr:8443/webhook/endpoint.php
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?
Seems like there's an issue somewhere reaching your server, yep
There's no ongoing issues at our end that would affect this
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
All sorted?
All my test is OK ๐ฎโ๐จ
the webhooks are received by the right server, everything is fine.
Thanks for telling me the socket error
No problem!
I could have tried for a long time to modify the code
๐คฃ
Can I give you a note?
Sure
you are performing well
Appreciate that ๐
i'm a self-employed contractor so it's good to have an outside opinion
Happy to hear you find us helpful ๐
I wish you a good day and see you soon
you too!
Thanks ! you can now close the discussion good luck