Reply
Highlighted
Member
Posts: 9
Registered: ‎06-19-2019

Trouble with Development and Testing Phase for Accept Hosted

Hello Everyone,

 

I am sorry if this has already been addressed, I was unable to find anything concerning my problem.

 

Platform is ASP.Net Core on Windows IIS.

 

Attempting to use Accept Hosted. I have been able to successfully use the Accept JS library but we are wanting to actually use the Accept Hosted method.

 

Does this require SSL to use on DEV?

Does this require domain or IP address to resolve for hostedPaymentReturnOptions and hostedPaymentIFrameComunicatorURL?

 

I have no issue getting a token, showing the IFrame, but the only message I can confirm recieving is:

{"resultCode":"Error","messageCode":"E00001","messageText":"Unexpected error. Please try again."}

 

Any help would be appreciated.  Let me know if you want me to post code, basically using the sample code they provided.

 

Highlighted
Member
Posts: 9
Registered: ‎06-19-2019

Re: Trouble with Development and Testing Phase for Accept Hosted

Testing form redirect to https://test.authorize.net/payment/payment instead of iFrame and the error is still:

 

{"resultCode":"Error","messageCode":"E00001","messageText":"Unexpected error. Please try again."}

 

Here is the code:

 

ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = AuthorizeNet.Environment.SANDBOX;
ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = new merchantAuthenticationType()
{
name = model.APILoginID,
ItemElementName = ItemChoiceType.transactionKey,
Item = model.TransactionKey,
};

settingType[] settings = new settingType[2];

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}";

 

var lineItems = new lineItemType[1];
lineItems[0] = new lineItemType { itemId = model.Item.Id, name = model.Item.Name, quantity = model.Item.Quantity, unitPrice = new Decimal(model.Item.Price) };


model.Amount = model.Item.Quantity * model.Item.Price;

var transactionRequest = new transactionRequestType
{
transactionType = transactionTypeEnum.authCaptureTransaction.ToString(), // authorize capture only
amount = new Decimal(model.Amount),
order = new orderType
{
invoiceNumber = model.Order.InvoiceNumber,
description = model.Order.Description
}
};

var request = new getHostedPaymentPageRequest();


request.transactionRequest = transactionRequest;
request.hostedPaymentSettings = settings;

 

// instantiate the controller that will call the service
var controller = new getHostedPaymentPageController(request);
controller.Execute();

 

// get the response from the service (errors contained if any)
return controller.GetApiResponse();