Posts: 1
Registered: ‎11-14-2019

Authorized dot net hosted Form response issues.

I am trying to integrate's hosted gateway and I have successfully generated a token for the same.

But after computing the payment how can I get payment status.
Currently, I am using a local server and also let me how to redirect page will success or fail payment status.

I have also added a webhook but didn't get any response.

Please assist me with the above-mentioned issues.

Note : Below is script that I am currently using.

  require 'vendor/autoload.php';
  require_once 'SampleCodeConstants.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;

  define("AUTHORIZENET_LOG_FILE", "phplog");
function getAnAcceptPaymentPage()
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    // Set the transaction's refId
    $refId = 'ref' . time();

    //create a transaction
    $transactionRequestType = new AnetAPI\TransactionRequestType();

    // Set Hosted Form options
    $setting1 = new AnetAPI\SettingType();
    $setting1->setSettingValue("{\"text\": \"Pay\"}");

    $setting2 = new AnetAPI\SettingType();
    $setting2->setSettingValue("{\"show\": false}");

    $setting3 = new AnetAPI\SettingType();
        "{\"url\": \"http://localhost/Test/authorized/auth-receipt.php\", \"cancelUrl\": \"\", \"showReceipt\": true}"

    // Build transaction request
    $request = new AnetAPI\GetHostedPaymentPageRequest();

    //execute request
    $controller = new AnetController\GetHostedPaymentPageController($request);
    $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX);
    if (($response != null) && ($response->getMessages()->getResultCode() == "Ok")) {
//echo 'Token Created';
       // echo $response->getToken()."\n";
    } else {
       // echo "ERROR :  Failed to get hosted payment page token\n";
        $errorMessages = $response->getMessages()->getMessage();
        //echo "RESPONSE : " . $errorMessages[0]->getCode() . "  " .$errorMessages[0]->getText() . "\n";
    return $response;
if (!defined('DONT_RUN_SAMPLES')) {
    $responce = getAnAcceptPaymentPage();
//echo $responce->getToken();
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<title>Authrized dot net redirect</title>
<form action="" method="post" id="frmPaymentRedirect">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="token" value="'.$responce->getToken().'" />
<script type="text/javascript">document.getElementById("frmPaymentRedirect").submit();</script>


Thank you,
Posts: 11
Registered: ‎10-07-2019

Re: Authorized dot net hosted Form response issues.


I just yesterday asked a similar question



I have not figured out the way to pass refId into AZ via their API,


but once that' is passed in, you would have to create a event subscription notification receiver

(basically a separate app or a separate REST end point in your existing backend.

And 'listen' to events comming from, in there with event payload, there will be merchantReferenceId (which is the refId that we are somehow supposed to pass in (this is part I still do not know) )


And that's how you will be able to get status and details of the CC Payment.


you will not be able to get it 'inline' when AZ redirects User's webbrowser from their Hosted Payment page back to your http://localhost/Test/authorized/auth-receipt.php


Posts: 1
Registered: ‎11-22-2019

Re: Authorized dot net hosted Form response issues.

If your issue regarding Authorized dot net hosted Form response issues is not yet resolved then you can contact me...


I can help in that matter just hit me up at my personal email

New Member
Posts: 1
Registered: ‎07-23-2020

Re: Authorized dot net hosted Form response issues.

We are using Redirect module to capture payments, that is a token is generated by calling getHostedPaymentPageRequest, after receiving the token we do a form post to page, for to capture the payment details.

We are able to successfully implement the above process, however upon clicking on "Pay" on payments page it is redirecting to receipt page, even if we set "showReceipt\": false for hostedPaymentReturnOptions settings.

Also, after clicking on ‘Continue to site’ button on receipt page, its successfully redirected to desired custom ‘AuthorizeNetReturn.aspx’ page of our application but we are unable to get or read receipt/transaction response data i.e. responseCode,AuthorizationCode and TransactionID on ‘AuthorizeNetReturn.aspx’ page

Below is the code

ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = AuthorizeNet.Environment.SANDBOX;

           ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = new merchantAuthenticationType()


               name = loginID,

               ItemElementName = ItemChoiceType.transactionKey,

               Item = transactionKey,


settingType[] settings = new settingType[7];


string returnURL = CommonHelper.GetStoreLocation(false) + "AuthorizeNetReturn.aspx";

settings[0] = new settingType();

settings[0].settingName = settingNameEnum.hostedPaymentButtonOptions.ToString();

settings[0].settingValue = "{\"text\": \"Pay\"}";


settings[1] = new settingType();

settings[1].settingName = settingNameEnum.hostedPaymentOrderOptions.ToString(); settings[1].settingValue = "{\"show\": true}";


settings[2] = new settingType();

settings[2].settingName = settingNameEnum.hostedPaymentReturnOptions.ToString();


settings[2].settingValue = "{\"url\": \"" + returnURL + "\",\"urlText\":\"Continue to site\",\"cancelUrl\": \"" + returnURL+"\", \"showReceipt\": false}";


settings[3] = new settingType();

settings[3].settingName = settingNameEnum.hostedPaymentPaymentOptions.ToString();

settings[3].settingValue = "{\"cardCodeRequired\": true, \"showCreditCard\": true, \"showBankAccount\": false}";


settings[4] = new settingType();

settings[4].settingName = settingNameEnum.hostedPaymentBillingAddressOptions.ToString();

settings[4].settingValue = "{\"show\": false}";


settings[5] = new settingType();

settings[5].settingName = settingNameEnum.hostedPaymentShippingAddressOptions.ToString();

           settings[5].settingValue = "{\"show\": false}";


settings[6] = new settingType();

settings[6].settingName = settingNameEnum.hostedPaymentIFrameCommunicatorUrl.ToString();

           settings[6].settingValue = "{\"url\": \"" + returnURL+"?mode=post" + "\"}";


var billTo = new customerAddressType


               firstName = order.BillingFirstName,

               lastName = order.BillingLastName,

               address = order.BillingAddress1,

               city = order.BillingCity,

               state = order.BillingStateProvince,

               zip = order.BillingZipPostalCode,





var shipTo = new customerAddressType


               firstName = order.ShippingFirstName,

               lastName = order.ShippingLastName,

               address = order.ShippingAddress1,

               city = order.ShippingCity,

               state = order.ShippingStateProvince,

               zip = order.ShippingZipPostalCode,

               country = order.ShippingCountry,

               phoneNumber = order.ShippingPhoneNumber


var transactionRequest = new transactionRequestType


               transactionType = transactionTypeEnum.authCaptureTransaction.ToString(),  

               amount = Convert.ToDecimal(order.OrderTotal.ToString("####.00", new CultureInfo("en-US", false).NumberFormat)),

               billTo = billTo,





           var request = new getHostedPaymentPageRequest();

           request.transactionRequest = transactionRequest;

           request.hostedPaymentSettings = settings;


           // instantiate the controller that will call the service

           var controller = new getHostedPaymentPageController(request);



           // get the response from the service (errors contained if any)

           var response = controller.GetApiResponse();

           if (response != null)


               if (response.messages.resultCode == messageTypeEnum.Ok)



                   remotePostHelper.Add("token", response.token.ToString());




We went through the documentation of and as per that we tried using both hostedPaymentIFrameCommunicatorUrl and hostedPaymentReturnOptions, but with none we could acheive the desired result. 


One more thing which we wanted to mention here is that we are not using iframe, but instead doing a form post to to capture credit card details and return back data to our application. 


Kindly advise if we were missing out anything, any help will be much appreciated.