Reply
Member
Posts: 4
Registered: ‎03-13-2017

Webhook not working on my end

Hi,

 

I created a webhook to requestb.in, it's working fine.

then I created a new webhook to my website:

 https://docbotdev.short-save.com/webhooks/authorizenet

 

I don't receive any notification.

So I try to test the webhook, but it's return 500 error.

 

Webhook:

webhookId" => "16b909ea-7a57-4602-a227-d031ecb2eb73"
  "status" => "inactive"
  "url" => "https://docbotdev.short-save.com/webhooks/authorizenet"
  "eventTypes" => array:1 [
    0 => "net.authorize.customer.subscription.created"
  ]

 and the response from: https://apitest.authorize.net/rest/v1/webhooks/16b909ea-7a57-4602-a227-d031ecb2eb73/pings

 

array:4 [  "status" => 500
  "reason" => "PING_FAILED"
  "message" => "The ping operation failed. This could be due to connectivity issues, invalid url or server downtime. Check the url details for the webhook and try again."
  "correlationId" => "e5a64aa4-bca1-4777-9778-f6f016511e5f"]

 

but my end is not down. The website https://httpstatus.io/ can check my url and it returns code 200 

 

 

 

 

 

 

 

 

 

 

 

 

Administrator
Posts: 209
Registered: ‎11-03-2016

Re: Webhook not working on my end

[ Edited ]

Hi @DanDrix,

 

Something like httpstatus.io or just checking your URL in a browser isn't a sufficient test. That will test that your server is up and able to respond to a GET request at that URL. However, a Webhooks notification is an HTTP POST to that URL.

 

Our server attempts to post to that URL using a content-type of application/json and a body containing the JSON object with all of the notification info. If you don't have that URL set up to accept a POST, it won't work.

 

I verified from my end that I get no response when I connect to that URL and do a POST like the Webhooks system. If I just do a regular form post to that URL (like with application/x-www-form-urlencoded), that works, but to try to post some JSON data with a content-type of application/json fails. You'll need to adjust things on your end to be able to recognize that content-type and pass the notification object into your code.

-Aaron

Aaron Wright
Developer Evangelist - Authorize.Net

Follow Authorize.Net developer news on Twitter!
Administrator
Posts: 209
Registered: ‎11-03-2016

Re: Webhook not working on my end

Wait, it's working now when I test it. I don't know if you were changing things as I was typing, but I get a 200 response now. You should get a succesful response from the pings command now.

-Aaron

Aaron Wright
Developer Evangelist - Authorize.Net

Follow Authorize.Net developer news on Twitter!
Member
Posts: 4
Registered: ‎03-13-2017

Re: Webhook not working on my end

My site allows POST with json, I tested with postman and returns code 200.

I didn't change anything
But I still get code 500 when i am trying to ping

Member
Posts: 4
Registered: ‎03-13-2017

Re: Webhook not working on my end

I believe I figured.

 

I did some tests and secure url (https://) was return error code 500 when I was trying to ping.

But  with non-secure url (http://) it works as expected.

 

And my website auto redirect to https.

My server accepts HTTP POST and it's working with postman (app to test HTTP requests) and  the website www.hurl.it

 

 

 

 

Administrator
Posts: 209
Registered: ‎11-03-2016

Re: Webhook not working on my end

Yeah, you're right. There's something funny going on. 

 

Using requestb.in, I can see what headers come in a notification request, and then I create a curl command using those same headers:

 

curl -v -X POST -H "Accept:" -H "User-Agent:" -H "Accept-Encoding: gzip" -H "Content-Length: 209" -H "Expect: 100-continue" -H "X-Anet-Signature: sha512=38546842C5CE9A54DAB16B66FE7F501E45A0CB9144E5BB568017643901BD71205B44484B4C26E739FD5A87C28E5E5A483D0929FD461A3AAC4F84879AB388CE4E" -H "Content-Type: application/json" -d '{"notificationId":"1947e7d0-4fb6-403d-913c-5ee33c4ab10f","eventDate":"2017-03-14T15:41:01.9004341Z","webhookId":"ce6d9f1f-16ea-43b0-b212-52238af7986a","payload":["net.authorize.customer.subscription.created"]}' "https://docbotdev.short-save.com/webhooks/authorizenet"

If I run that from my machine, I get a 200 response from your server. But, the Webhooks "pings" command, which should be doing the same thing, is reporting an error. I've got to look into this deeper on our end, but first, any more information you can give?

 

Is there any firewall setup on your end that might be blocking the incoming requests from our IPs? Any way for you to check a firewall or router log to see if any traffic from our IPs are even hitting your network at the correct times?

 

-Aaron

Aaron Wright
Developer Evangelist - Authorize.Net

Follow Authorize.Net developer news on Twitter!
Administrator
Posts: 209
Registered: ‎11-03-2016

Re: Webhook not working on my end

Sorry, I missed your last post while I was typing my reply.

 

If you register your URL as http for a webhook, the pings command will still fail because of the redirect you have in place. We'll try to send the notification to the http URL, and your server will respond with a "302" instead of a "200". Instead of doing a new request, we just report an error since we didn't receive a "200" response.

 

So, if you wanted to use the http URL, you'd need to not redirect.

 

However, I think you'd prefer to use the https url, and I still don't know why that won't work. If you hit it directly there's no redirect to confuse things, so why can I post the same data from curl or postman, but when the Webhooks system posts it it fails?

 

Do you have any log on your side of a connection from our Webhooks system and what exactly it's posting to you?

-Aaron

Aaron Wright
Developer Evangelist - Authorize.Net

Follow Authorize.Net developer news on Twitter!
Member
Posts: 4
Registered: ‎03-13-2017

Re: Webhook not working on my end

So, I register the URL with https to avoid redirects.

 

But I am seeing the http:// works but https:// doesn't 

 

https://docbotdev.short-save.com/test-dan123.php (secure URL, it doesn't work)
http://sandbox.short-save.com/test-dan123.php      (non-secure URL, it works )
https://secure.short-save.com/test-dan123.php       (secure URL, it doesn't work)

 

all the links are in the same enviroment. 

So, I don't think it's some kind of firewall.

I believe it's something related to the SSL
because your server have to have a SSL certificate as well to communicate with mine.