我为authorize.NET AIM网关auth_capture事务编写了以下代码:
try
{
if (transactionAmount == 0)
{
Logger.WriteInfo("$0 transaction needs no payment Gateway Transaction ");
}
else
{
//This function sends auth_capture request and processes payment based on transaction parameters.
TransactionResponse transactionResponse = ProcessPayment(dist, fee);
transactionID = transactionResponse.TransactionID;
transactionStatus = transactionResponse.Status;
serverResponse = transactionResponse.ServerResponse;
}
}
catch (TimeoutException tex)
{
context.Dispose();
Logger.WriteError(ex.ToString());
Master.ErrorMessage = ConfigurationManager.AppSettings["TRANSACTION_TIMEOUT_MESSAGE"];
IEUtils.SendExceptionMail(ex.tex, ConfigurationManager.AppSettings["TRANSACTION_TIMEOUT_EMAIL_SUBJECT"]);
Logger.WriteError(ex.ToString());
}
catch (Exception ex)
{
context.Dispose();
Logger.WriteError(ex.ToString());
Master.ErrorMessage = ex.Message;
return;
}
情况是,如果发生超时,我们如何才能看到交易是否已经发生,如果是,那么交易ID是什么?有一些方法可用于获得已结算/未结算的交易,但识别最近的交易需要多次api调用,这也是有风险的。在authorize.Net网关事务请求超时后,最有效的解决方法是什么?