Hello,
I am trying to integrate auth net DPM with our project. Currently I just started off by running the example from
http://developer.authorize.net/guides/DPM/wwhelp/wwhimpl/js/html/wwhelp.htm
I use JSP exactly like the examples mentioned above.
The problem is that I don't receive any parameters back.
Here is the checkout.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Checkout Page</title>
</head>
<body>
<%@ page import="net.authorize.sim.*"%>
<%
String apiLoginId = "LOGIN_ID";
String transactionKey = "TR_KEY";
String relayResponseUrl = "http://efip.softcomputer.com/epeHG/ocs/payment/anet/relay.jsp";
//"http://efip.softcomputer.com/epeHG/ocs/payment/anet/relay.jsp";
//"https://developer.authorize.net/tools/paramdump/index.php";
String amount = "1.99";
//random sequence used for the fingerprint
long seq = 1234567890;
Fingerprint fingerprint = Fingerprint.createFingerprint(apiLoginId, transactionKey, seq, amount);
long x_fp_sequence = fingerprint.getSequence();
long x_fp_timestamp = fingerprint.getTimeStamp();
String x_fp_hash = fingerprint.getFingerprintHash();
%>
<form id='secure_redirect_form_id' action='https://secure.authorize.net/gateway/transact.dll' method='POST'>
<label for='x_card_num'>Credit Card Number</label>
<input type='text' class='text' id='x_card_num' name='x_card_num' size='20' maxlength='16' />
<br>
<label for='x_exp_date'>Expiration Date</label>
<input type='text' class='text' id='x_exp_date' name='x_exp_date' size='6' maxlength='6' />
<br>
<label for='x_amount'>Amount</label>
<input type='text' class='text' id='x_amount' name='x_amount' size='10' maxlength='10' readonly='readonly' value='<%=amount%>' />
<br>
<input type='hidden' name='x_invoice_num' value='<%=System.currentTimeMillis()%>' />
<input type='hidden' name='x_relay_url' value='<%=relayResponseUrl%>' />
<input type='hidden' name="x_relay_response" value='TRUE'>
<input type='hidden' name='x_login' value='<%=apiLoginId%>' />
<input type='hidden' name='x_fp_sequence' value='<%=x_fp_sequence%>' />
<input type='hidden' name='x_fp_timestamp' value='<%=x_fp_timestamp%>' />
<input type='hidden' name='x_fp_hash' value='<%=x_fp_hash%>' />
<input type='hidden' name='x_version' value='3.1' />
<input type='hidden' name='x_method' value='CC' />
<input type='hidden' name='x_type' value='AUTH_ONLY' />
<input type='hidden' name='x_amount' value='<%=amount%>' />
<input type='hidden' name='x_test_request' value='TRUE' />
<input type='hidden' name='notes' value='' />
<input type='submit' name='Process' value='Process' />
</form>
</body>
</html>
And relay.jsp
<%@page import="java.util.Map"%>
<%@ page import="net.authorize.*"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<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) {
<%String apiLoginId = "LOGIN_ID";
String receiptPageUrl = "http://efip.softcomputer.com/epeHG/ocs/payment/anet/receipt.jsp";
/*
* Leave the MD5HashKey as is - empty string, unless you have explicitly
* set it in the merchant interface:
* Account > Settings > Security Settings > MD5-Hash
*/
String MD5HashKey = "";
Map map = request.getParameterMap();
net.authorize.sim.Result result = net.authorize.sim.Result
.createResult(apiLoginId, MD5HashKey,
map );
// perform Java server side processing...
// ...
// build receipt url buffer
StringBuffer receiptUrlBuffer = new StringBuffer(receiptPageUrl);
if (result != null) {
receiptUrlBuffer.append("?");
receiptUrlBuffer.append(
ResponseField.RESPONSE_CODE.getFieldName()).append("=");
receiptUrlBuffer.append(result.getResponseCode().getCode());
receiptUrlBuffer.append("&");
receiptUrlBuffer.append(
ResponseField.RESPONSE_REASON_CODE.getFieldName())
.append("=");
receiptUrlBuffer.append(result.getReasonResponseCode()
.getResponseReasonCode());
receiptUrlBuffer.append("&");
receiptUrlBuffer.append(
ResponseField.RESPONSE_REASON_TEXT.getFieldName())
.append("=");
receiptUrlBuffer.append(result.getResponseMap().get(
ResponseField.RESPONSE_REASON_TEXT.getFieldName()));
if (result.isApproved()) {
receiptUrlBuffer
.append("&")
.append(ResponseField.TRANSACTION_ID.getFieldName())
.append("=");
receiptUrlBuffer.append(result.getResponseMap().get(
ResponseField.TRANSACTION_ID.getFieldName()));
}
}%>
// Use Javascript to redirect the page to the receipt redirect url.
// If Javascript is not available, then the <meta> refresh tag
// will handle the redirect.
document.location = "<%=receiptUrlBuffer.toString()%>
";
}
//-->
</script>
<noscript>
<meta http-equiv="refresh"
content="0;url=<%=receiptUrlBuffer.toString()%>">
</noscript>
</body>
</html>
When I put a breakpoint in relay.jsp I see that request.getParameterMap() is empty.
When I contacted customer support they asked for the response string from Auth Net so that they can troubleshoot the problem. I tried to explain that the problem is I don't get response. Was redirected to developers forum...
12-06-2012 12:54 PM - edited 12-06-2012 12:56 PM
you were able set a break point on your web server?If you use the https://developer.authorize.net/tools/paramdump/index.php as the relay url does it have any parameters?
12-06-2012 04:18 PM
Yes I did set a breakpoint on my web server and checked the request parameters received by relay.jsp
I also use Fiddler (http://www.fiddler2.com/fiddler2/) to look up request and response contents
When I use the https://developer.authorize.net/tools/paramdump/index.php as the relay URL I get the following
Learn more about the Authorize.Net Data Validation URL Tool.
REMOTE_ADDR: | 10.1.190.51 |
REQUEST_METHOD: | POST |
HTTP_REFERER: | none |
This is a test mode transaction.
Field Name Field Value
x_response_code | 1 |
x_response_reason_code | 1 |
x_response_reason_text | (TESTMODE) This transaction has been approved. |
x_avs_code | P |
x_auth_code | 000000 |
x_trans_id | 0 |
x_method | CC |
x_card_type | Visa |
x_account_number | XXXX1111 |
x_first_name | |
x_last_name | |
x_company | |
x_address | |
x_city | |
x_state | |
x_zip | |
x_country | |
x_phone | |
x_fax | |
x_email | |
x_invoice_num | 1354883532283 |
x_description | |
x_type | auth_only |
x_cust_id | |
x_ship_to_first_name | |
x_ship_to_last_name | |
x_ship_to_company | |
x_ship_to_address | |
x_ship_to_city | |
x_ship_to_state | |
x_ship_to_zip | |
x_ship_to_country | |
x_amount | 1.99 |
x_tax | 0.00 |
x_duty | 0.00 |
x_freight | 0.00 |
x_tax_exempt | FALSE |
x_po_num | |
x_MD5_Hash | B99B7CD295F233E81204F8C56A6D38EC |
x_cvv2_resp_code | |
x_cavv_response | |
x_test_request | true |
notes | |
Process | Process |
12-07-2012 04:34 AM
Not sure why it wouldn't work. I use something similar in asp.net. Since you have a break point on that page, maybe you can see what is on the other request properties.
12-07-2012 06:50 AM
The request is empty. Looks like it's a bug on Authorize Net side. Where can I report this?
12-07-2012 07:15 AM
can't see why it would just not send to your jsp page. Have you try to post something to that page yourselves?
12-07-2012 12:38 PM