Reply
Member
Posts: 2
Registered: ‎03-31-2021
Accepted Solution

No payload return to my webhook.

Hi,

 

First sorry for my English skill. I'm new member,  I tried search my issue but not found anything.

 

I have some problems with Webhook feature. I registered an sandbox account. I tried adding a webhook (Account => Setting => Bussinue Setting => Webhook), but it didn't work as I thought.
As document:  (https://developer.authorize.net/api/reference/features/webhooks.html#Verifying_the_Notification section "Payment Profile Event Payload Example"), it will return to me a payload. But look like it didn't send anything to my hook although it called my hook after I cancel a subscription payment (ARB subscription) .
On my hook, I just log $_REQUEST, $_POST (PHP language) to log file, but it's empty.
So please let me know what I'm missing in here?


Thanks & Regards.


Accepted Solutions
Solution
Accepted by topic author trungnguyen90
‎04-01-2021 08:11 PM
Posts: 485
Topics: 0
Kudos: 96
Blog Posts: 0
Ideas: 0
Solutions: 40
Registered: ‎04-28-2017

Re: No payload return to my webhook.

[ Edited ]

Hello @trungnguyen90,

 

Capturing the Authorize.net webhook payload is very simple. One way, with PHP is to save the webhook event to a file:

<?php
$filename = "webhook_data.txt";
$fh = fopen($filename, 'a') or die("can't open file");
$xSig ="";
if (isset($_SERVER['X-ANET-Signature'])){
$xSig = $_SERVER['X-ANET-Signature'];
}
$input = json_decode(file_get_contents('php://input'), true);
//echo json_encode($input);
// Write payload contents into a text file for reference

$payload = json_encode($input);

//$file = fopen("webhook_data.txt","a") or die("Unable to open file!!!");
fwrite($fh, "Xsig: ".$xSig. " payload: ".$payload."\n");
fclose($fh);

 

Powered by NexWebSites.com -
Certified Authorize.net developers

View solution in original post


All Replies
Solution
Accepted by topic author trungnguyen90
‎04-01-2021 08:11 PM
Posts: 485
Topics: 0
Kudos: 96
Blog Posts: 0
Ideas: 0
Solutions: 40
Registered: ‎04-28-2017

Re: No payload return to my webhook.

[ Edited ]

Hello @trungnguyen90,

 

Capturing the Authorize.net webhook payload is very simple. One way, with PHP is to save the webhook event to a file:

<?php
$filename = "webhook_data.txt";
$fh = fopen($filename, 'a') or die("can't open file");
$xSig ="";
if (isset($_SERVER['X-ANET-Signature'])){
$xSig = $_SERVER['X-ANET-Signature'];
}
$input = json_decode(file_get_contents('php://input'), true);
//echo json_encode($input);
// Write payload contents into a text file for reference

$payload = json_encode($input);

//$file = fopen("webhook_data.txt","a") or die("Unable to open file!!!");
fwrite($fh, "Xsig: ".$xSig. " payload: ".$payload."\n");
fclose($fh);

 

Powered by NexWebSites.com -
Certified Authorize.net developers
Member
Posts: 2
Registered: ‎03-31-2021

Re: No payload return to my webhook.

Thank you very much. It saved my time.

I usualy use $_POST and $_REQUEST, but forget php:input, the payload is JSON format, not normal form-data render format, so that can't use $_POST in here.

 

Thanks for your support.

New Member
Posts: 3
Registered: ‎04-04-2021

Re: No payload return to my webhook.

[ Edited ]

For High Availability and High Throughput reasons - we always return a success message with a payload of debugging information when collecting a webhook - regardless of whether there is a Zap behind the webhook or if it is paused or not. The only way to know if a URL is live is to visit the editor and look at the URL (which never changes for a Zap). There is no way to customize the response to the request you send to the Catch Hook URL, as the response is sent before the Zap triggers and runs on the webhook request.

 

 

https://myccpaylogin.net/