cancel
Showing results for 
Search instead for 
Did you mean: 

Showreceipt set to false makes the Pay button stuck showing"processing"

I am trying to integrate by embedding the iframe . The communicator page sends response to the events. When I click on the Pay button, the button is stuck showing "processing.." This happens when the showreceipt is set to "false", but when I set it to true, the payment is processed and shows the receipt page.

After clicking Pay button I want it to be forwarded back to our site to display custom receipt after payment processing that is the reason for setting showreceipt to "false". 

Does somebody have any thoughts or suggestions for this issue?

schitti_123
Member
6 REPLIES 6
@schitti_123

Post your code and I may be able to help you.
Renaissance
All Star

@Renaissance 

 

 

public class HomeController : Controller
{
IHostingEnvironment _env;
IConfiguration _config;
public HomeController(IHostingEnvironment env, IConfiguration config)
{
_env = env;
_config = config;
}


public IActionResult Index()
{
customerAddressType BillTo = new customerAddressType
{
address = "120 Sceneic Drive",
city = "Twinsburg ",
state = "OH",
zip = "14326",
firstName = "Sam",
lastName = "Donald",
country = "USA",
phoneNumber = "4454546589",
};

int CreditCardTransactionID = 121212;
decimal Amount = 100;
int OrderID = 1234567;
string IPAddress = "127.0.0.1";
int CustomerID = 5129999;
transactionTypeEnum transtype = transactionTypeEnum.authCaptureTransaction;

merchantAuthenticationType mat = new merchantAuthenticationType
{
name = _config.GetValue<string>("Authorize.Net:TransactionKey"),
ItemElementName = ItemChoiceType.transactionKey,
Item = _config.GetValue<string>("Authorize.Net:Password"),
};

string CancelURL;
string ReturnURL;
string URL;
string CommunicatorURL;
string PaymentPageURL;
string ShowReceipt = "false";

string HostURL = _config.GetValue<string>("RootURL");

switch ((_env.EnvironmentName ?? "").Trim().ToUpper())
{
case "DEVELOPMENT":
string NGrokPath = $"{HostURL}/Home";
CommunicatorURL = $"{NGrokPath}/Communicator";
CancelURL = $"{NGrokPath}/Cancel";
ReturnURL = $"{NGrokPath}/Returning";
PaymentPageURL = $"{NGrokPath}/";
URL = $"{NGrokPath}";
break;
case "STAGING":
case "PRODUCTION":
CommunicatorURL = $"{HostURL}/Home/Communicator";
CancelURL = $"{HostURL}/Home/Cancel";
ReturnURL = $"{HostURL}/Home/Returning";
PaymentPageURL = $"{HostURL}/";
ShowReceipt = "true";
break;
default:
return Error();
}

HostedPayment hp = new HostedPayment(mat, AuthorizeNet.Environment.SANDBOX);
HostedToken ht = hp.AttemptTransaction(CreditCardTransactionID, Amount, OrderID, IPAddress, CustomerID, null, false, transtype, BillTo, ReturnURL, CancelURL, CommunicatorURL, PaymentPageURL, ShowReceipt);
return View(ht);
}
public IActionResult Cancel()
{
return Content("Cancelled");
}

public IActionResult Returning()
{
return Content("Done!");
}
public IActionResult Communicator()
{
return View();
}
[Route("/Home/Empty1")]
[Route("/Home/Home/Empty1")]
public IActionResult Empty1()
{
return View();
}

[HttpPost]
public IActionResult WebHook()
{
string s = "";
using (StreamReader reader = new StreamReader(Request.Body, Encoding.UTF8))
{
s = reader.ReadToEnd();
}
System.Diagnostics.Debug.WriteLine("##### " + s);
return Ok();
}

[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
}
}

 

 

 

I used the suggestion in this link for now as a workaround. Also I want the json result to be pushed to webhook, if you could share any thoughts about that that would be helpful.

 

https://stackoverflow.com/questions/43700622/how-to-implement-authorize-net-hosted-payments-iframe-l...

 

 

Thanks

Chitti

@schitti_123

What happens when you click the cancel button? And can you print out what is being output as the Host URL?

 @Renaissance Sorry for the delay in responding. The Cancel button works, If I give CancelUrl it redirects to that Url. I use ngrok tunnel for testing as I cannot use the local host. The issue now is pushing the json data to our server for validation. Not sure how to do that in Asp.net MVC.

@schitti_123 

 

 

Did you ever work this out? I am now having the same issue on an integration I am working on. Very odd.

Tied the issue back to my communicator not working properly.