cancel
Showing results for 
Search instead for 
Did you mean: 

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.

trungnguyen90
Member
1 ACCEPTED SOLUTION

Accepted Solutions

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

NexusSoftware
Trusted Contributor
3 REPLIES 3

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
NexusSoftware
Trusted Contributor

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.

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/

opiddth
Member