cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

API hosted form can't post after initial validation error

I am able to get the hosted form to come up and can process payments as long as the form validation passed. 

 

I am getting the following error whenever the user inputs an incorrect field.  I get the error message for the problem, then when it is corrected and clicking pay invoice I get an error "fingerprint value is not valid".  This is happening in the sandbox and production.  This example is in production, I entered an invalid expiration date:

 

paymentTransaction1.jpg

 

paymentTransaction2.jpg

 

Now the user is stuck and has to cancel and come back in to process the payment.  Also, I have the cancel event being captured via the iframe communicator and this does not work after this error so the iframe redirects to the cancelUrl passed in with the token request.  I can't get the cancel event to trigger unless I provide a cancel url.   Here is my javascript to handle the events:

 

$(document).ready(function () {

 

           window.CommunicationHandler = {};

 

function parseQueryString(str) {

var vars = [];

var arr = str.split('&');

var pair;

for (var i = 0; i < arr.length; i++) {

                   pair = arr[i].split('=');

                   vars[pair[0]] = unescape(pair[1]);

               }

return vars;

           }

 

           window.CommunicationHandler.onReceiveCommunication = function (argument) {

var params = parseQueryString(argument.qstr);

               console.log(argument);

switch (params['action']) {

case "resizeWindow":

//alert('resizeWindow: width-' + params['width'] + ' height-' + params['height']);

var iFrame = document.getElementById('authNetIFrame');

                       iFrame.width = params['width'];

                       iFrame.height = params['height'];

break;

case "cancel":

if (_paymentDetail) {

                           _paymentDetail.hide();

                           location.reload(true);

                       }

 

break;

case "transactResponse":

var transResponse = JSON.parse(params['response']);

 

if (transResponse.responseCode == 1) {

var firstName = '';

var lastName = '';

var city = '';

var state = '';

var zip = '';

var address = '';

 

if (transResponse.billTo != 'undefined') {

                               firstName = transResponse.billTo.firstName;

                               lastName = transResponse.billTo.lastName;

                               city = transResponse.billTo.city;

                               state = transResponse.billTo.state;

                               zip = transResponse.billTo.zip;

                               address = transResponse.billTo.address;

                           }

                           ProcessPaymentReceipt(transResponse.transId, transResponse.accountType, transResponse.accountNumber, firstName, lastName, city, state, zip, address);

                       }

break;

               }

           }

 

       });

 

 

Here is the C# code to build the request:

 

public getHostedPaymentPageResponse GetHostedResponse(String ApiLoginID, String ApiTransactionKey, decimal paymentAmount, bool testMode)

              {

var borrGuid = "";

if (UserID == 0 && !string.IsNullOrEmpty(Borrower.AppraisalOrder.PaymentGuid))

                           borrGuid = Borrower.AppraisalOrder.PaymentGuid;

 

ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = testMode ? AuthorizeNet.Environment.SANDBOX : AuthorizeNet.Environment.PRODUCTION;

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

                     {

                           name = ApiLoginID,

                           ItemElementName = ItemChoiceType.transactionKey,

                           Item = ApiTransactionKey,

                     };

 

var transactionRequest = new transactionRequestType

                     {

                           transactionType = transactionTypeEnum.authCaptureTransaction.ToString(),    // authorize capture only

                           amount = paymentAmount,

                           poNumber = borrGuid

                     };

 

settingType[] settings = new settingType[9];

 

                     settings[0] = new settingType();

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

                     settings[0].settingValue = "{\"showReceipt\": false, \"cancelUrl\": \"" + AdminModel.BaseUrl + "\", \"cancelUrlText\": \"Cancel\"}";

 

                     settings[1] = new settingType();

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

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

 

                     settings[2] = new settingType();

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

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

 

                     settings[3] = new settingType();

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

                     settings[3].settingValue = "{\"captcha\": false}";

 

                     settings[4] = new settingType();

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

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

 

                     settings[5] = new settingType();

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

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

 

                     settings[6] = new settingType();

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

                     settings[6].settingValue = "{\"showEmail\": false, \"requiredEmail\": false, \"addPaymentProfile\": false}";

 

                     settings[7] = new settingType();

                     settings[7].settingName = settingNameEnum.hostedPaymentOrderOptions.ToString();

                     settings[7].settingValue = "{\"show\": false, \"merchantName\": \"\"}";

 

                     settings[8] = new settingType();

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

                     settings[8].settingValue = "{\"url\": \"" + AdminModel.BaseUrl + "InvoiceCommunicator.html\"}";

 

var request = new getHostedPaymentPageRequest();

                     request.transactionRequest = transactionRequest;

                     request.refId = UserID.ToString();

                     request.hostedPaymentSettings = settings;

 

// instantiate the contoller that will call the service

var controller = new getHostedPaymentPageController(request);

                     controller.Execute();

 

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

var response = controller.GetApiResponse();

 

return response;

              }

public string GetHostedFormToken()

              {

string token = "";

 

if (Test)

                     {

if (!string.IsNullOrEmpty(TestLogin))

                           {

                                  Login                = TestLogin;

                                  TransactionKey       = TestTransactionKey;

                           }

                     }

 

Decimal amt = 0;

Decimal.TryParse(PmtFormAmount, out amt);

 

var logger    = NLog.LogManager.GetLogger("AuthorizeNet");

var resp      = GetHostedResponse(Login,TransactionKey, amt, Test);

 

//validate

if (resp != null && resp.messages.resultCode == messageTypeEnum.Ok)

                     {

                           token = resp.token;

                     }

 

                     logger.Debug(() => String.Format("HostedFormToken: [{}{}{0}] : token  ", Borrower.BorrowerID.ToString()) + token);

 

return token;

              }

 

 

Thanks for your help.

mcarver8
Member
14 REPLIES 14

Has this been resolved yet?  I am still having this issue in sandbox

Hi!

 

I just discovered this same issue. I get no error code back to even know it was a failure, so the work around appears to not be valid.

 

Can we have an update on this please?

 

Thanks in advance!

scico100
Member

Hi , 

 

The fix for this issue is in progress .

 

As a workaround if you just create a signature key from your Merchant Interface , that should avoid this issue . 

 

 

To generate your Signature Key:

  1. Log into the Merchant Interface at https://account.authorize.net.
  2. Click Account from the main toolbar.
  3. Click Settings in the main left-side menu.
  4. Click API Credentials & Keys.
  5. Enter your Secret Answer.
  6. Select New Signature Key.
    • To disable the old Signature Key, click the check box labeled Disable Old Signature Key Immediately.
    • If the Disable Old Signature Key check box is not selected, the old Signature Key will automatically expire in 24 hours.
  7. Click Submit to continue. Your new Signature Key is displayed.

 

Hope it helps !!!

 

Thanks





Send feedback at developer_feedback@authorize.net

Thanks for the instructions on generating a new signature key.  However, that is not a real-time fix for this issue when the user is in the browser and receives this message.  Additionally, since the event cannot be intercepted via JS, our web app cannot know about it or do anything to resolve it.  We are completely dependent on Authorize.net to resolve the error, or for the user to report it to us.

 

Is there any update on the internal fix for this?

 

Cheers,

Hi @bwDialogs1

 

I believe once  you have generated the signature key , this issue shouldnt be seen by users . 

 

This  is a one time workaround  which will avoid the issue going forward . 

 

The date for fix i will keep posted . 

 

 

Thanks





Send feedback at developer_feedback@authorize.net