instead of redirecting the full url with query string parameters, the gateway displays the homepage, which is linked to the base url, and whats more it displays it inside https://test.authorize.net/gateway/transact.dll. I then tried putting all response parameters into a html form and submit it with javascript, which work until when trying to get the parameter and realise the system didn't receive any at all.
Need help on this.
Solved! Go to Solution.
โ06-12-2014 01:37 AM
Session doesn't come across to authorize.net, if you need to save something, either save it on your data before calling the dpm page or pass it as a merchant defined fields, which is any fields with name that are not from authorize.net
โ06-18-2014 04:18 AM
can you post the code/page source sample of what you are trying to do.
โ06-12-2014 04:48 AM
<%@ include file="header.jsp"%>
<%@ page import="java.util.*"%>
<%@ page import="java.net.URLEncoder"%>
<%@ page import="java.util.Map" %>
<%@ page import="net.authorize.*" %>
<%
boolean isRedirect = false;
String sessionid = (String) request.getSession().getAttribute("SessionId");
net.authorize.sim.Result result = null;
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
<script type="text/javascript">
<!--
var referrer = document.referrer;
if (referrer.substr(0,7)=="http://") referrer = referrer.substr(7);
if (referrer.substr(0,8)=="https://") referrer = referrer.substr(8);
if(referrer && referrer.indexOf(document.location.hostname) != 0) {
<%
/*
* Leave the MD5HashKey as is - unless you have explicitly set it in the
* merchant interface: Account > Settings > Security Settings > MD5-Hash
*/
String MD5HashKey = "";
result = net.authorize.sim.Result.createResult(
ClientWebService.AUTHORIZENET_LOGIN
, MD5HashKey
, request.getParameterMap()
);
isRedirect = result != null;
%>
}
//-->
</script>
<% if(isRedirect){ %>
<form name="resultdivert" method=post action="<%= Sys.getURL("*dynamic id for url generation*", request, sessionid) %>"
<input type=hidden name="<%= ResponseField.RESPONSE_CODE.getFieldName() %>" value="<%= result.getResponseCode().getCode() %>">
<input type=hidden name="<%= ResponseField.RESPONSE_REASON_CODE.getFieldName() %>" value="<%= result.getReasonResponseCode().getResponseReasonCode() %>">
<input type=hidden name="<%= ResponseField.RESPONSE_REASON_TEXT.getFieldName() %>" value="<%= result.getResponseMap().get(ResponseField.RESPONSE_REASON_TEXT.getFieldName()) %>">
<input type=hidden name="<%= ResponseField.INVOICE_NUMBER.getFieldName() %>" value="<%= result.getResponseMap().get(ResponseField.INVOICE_NUMBER.getFieldName()) %>">
<% if(result.isApproved()) { %>
<input type=hidden name="<%= ResponseField.TRANSACTION_ID.getFieldName() %>" value="<%= result.getResponseMap().get(ResponseField.TRANSACTION_ID.getFieldName()) %>">
<% } %>
</form>
<script>document.resultdivert.submit()</script>
<% }else{ %>
<div id="wrapper">
<div id="side"><img src="<%= request.getContextPath() %>/web/images/img_side_8_03.png" width="180" height="600" /></div>
<div id="content">
<table width="750" border="0" cellspacing="0" cellpadding="5" id="form">
<tr>
<td colspan=3 align="left" valign="middle"> </td>
</tr>
<tr>
<td align="left" valign="middle"><strong><b>Error: Failed to receive response from Authorize.net. Please contact system administrator. Do not re-submit sales.</b></td>
</tr>
</table>
</div>
</div>
<% } %>
</body>
</html>
The URL is dynamically generated due to our website uses member's id as domain name, so each member sees a different link, e.g. 001.website.com or something. The form post is successful but without all the parameters, so we're stuck in the development. Any help will be appreciated.
โ06-12-2014 07:53 PM
I also tried modifying the code to use query strings instead of html form post, but the result is that the gateway simply disregards all parameters and only execute the base url, which links to our homepage.
โ06-12-2014 08:05 PM
Can you try not redirect and read what is in the request.getParameterMap()
or comment out the
<script>document.resultdivert.submit()</script>
and see the web broswer page source to see if the value are in it.
โ06-13-2014 04:31 AM - edited โ06-13-2014 04:34 AM
Hi just want to inform that the test succeeded today, without any modification on my part. This is most strange. I'm using html form post.
EDIT: Sorry I did change something... I changed the MD5HashKey from empty string to login key. The documentation mentioned that this is suppose to be empty string if no setup is done at merchant area, but I suspect that this is wrong so I tried using login key instead, and it worked.
However, there is still the issue that the gateway tries to load the homepage for a few seconds, right before the redirect succeeded and my summary page is displayed. This few seconds could cause confusion for the user. Any idea as to why this is happening?
โ06-17-2014 07:30 PM - edited โ06-17-2014 07:40 PM
Another question.... If I save attributes in sessions before I proceed to the gateway, will the session remain in relay URL?
โ06-17-2014 11:46 PM
Session doesn't come across to authorize.net, if you need to save something, either save it on your data before calling the dpm page or pass it as a merchant defined fields, which is any fields with name that are not from authorize.net
โ06-18-2014 04:18 AM
Thanks for the help, things are working properly for me now, although I did encounter strange problems, such as relay url not working the first time, then I try again and it worked ever since.
One more question, how do I set it so that users can choose to cancel the payment on the payment form?
โ06-19-2014 08:01 PM
such as relay url not working the first time, then I try again and it worked ever since.
It could be that Authorize.net didn't have your ip address cache. Check your dns cache settings, it should be on your ip/domain register
One more question, how do I set it so that users can choose to cancel the payment on the payment form?
Since it is DPM, the payment form is on your site just add a button on your page to redirect to some where else.
โ06-20-2014 04:01 AM