cancel
Showing results for 
Search instead for 
Did you mean: 

Webhook empty using Accepted Host method

@Renaissance ,

 

 

 

 

nanqiyou
Member
13 REPLIES 13
@nanqiyou

The payload comes in json format. I think using the $_REQUEST[] variable is not going to work. And you are merely dumping the content in a .txt file. That is a very limited use of what webhooks can do.
Renaissance
All Star

ts will also be written to the log file.

for me, neither sandbox or live account workingin live mode,will trigger the webhook.

 

What do I have to do to get it to trigger!!

@a10ma4t5 

 

Run some test transactions. You'll get a webhook notification for all enrolled events. 

But this is the problem.

The webhook is not firing.

any hit to my webhook, will update the log file it creates.

The timestamp on the file doesn't even change.

 

But I'll check it again.

test results.

Environment: Sandbox live mode.

Webhook Listener Contents:

<?php

$headers = getallheaders();
$payload = file_get_contents("php://input");

$path=dirname(realpath(__FILE__));
$f=fopen($path.'/notify.log','a+');
fputs($f,print_r($payload,1));
fputs($f,print_r("<br />",1));
fclose($f);

 

?>

The webhook was NOT triggered.

Even if the info posted to me was empty, the log file would be created.

It was not.

 

This is the exact same problem that I have in the live account.

finally got the webhook to post and captured.

last problem I hope,,....

how do I pass my sites orderID to the GetHostedPaymentPageRequest so that the webhook wil post it back to me?

if you can't post any custom field from the site back via the webhook, then there is no way to identify what order the webhook is for as the URL for the webhook is set in the merchant account.

 

 

@a10ma4t5 

 

Looks like my advice worked for you. The answer to your question is to pass that as the invoice number in the API call and then retrieve it when you get the webhook. You also want to implement the hash verification piece once you get everything working. 

invoice number is too short,so I have to store it in a dbase table and so on....

what a pain.

however, I've done that now. and I'm trying to do a details lookup and I'm getting this error now.

Here is the code:

 

$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
$merchantAuthentication->setName($settingArray['loginid']);
$merchantAuthentication->setTransactionKey($settingArray['transactionid']);

// Set the transaction's refId
// The refId is a Merchant-assigned reference ID for the request.
// If included in the request, this value is included in the response.
// This feature might be especially useful for multi-threaded applications.
$refId = 'ref' . time();

$request = new AnetAPI\GetTransactionDetailsRequest();
$request->setMerchantAuthentication($merchantAuthentication);
$request->setTransId($transactionId);

$controller = new AnetController\GetTransactionDetailsController($request);

$response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);

 

And this is the error:

net\authorize\api\contract\v1\GetTransactionDetailsResponse Object
(
[transaction:net\authorize\api\contract\v1\GetTransactionDetailsResponse:private] =>
[clientId:net\authorize\api\contract\v1\GetTransactionDetailsResponse:private] =>
[transrefId:net\authorize\api\contract\v1\GetTransactionDetailsResponse:private] =>
[refId:net\authorize\api\contract\v1\ANetApiResponseType:private] =>
[messages:net\authorize\api\contract\v1\ANetApiResponseType:private] => net\authorize\api\contract\v1\MessagesType Object
(
[resultCode:net\authorize\api\contract\v1\MessagesType:private] => Error
[message:net\authorize\api\contract\v1\MessagesType:private] => Array
(
[0] => net\authorize\api\contract\v1\MessagesType\MessageAType Object
(
[code:net\authorize\api\contract\v1\MessagesType\MessageAType:private] => E00003
[text:net\authorize\api\contract\v1\MessagesType\MessageAType:private] => The element 'getTransactionDetailsRequest' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has invalid child element 'clientId' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'. List of possible elements expected: 'merchantAuthentication' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'.
)

)

)

[sessionToken:net\authorize\api\contract\v1\ANetApiResponseType:private] =>
)

@a10ma4t5 

 

This is too much to answer here. Sending you an IM.