cancel
Showing results for 
Search instead for 
Did you mean: 

Direct Post Method (DPM) not working

Popular shopping cart vender with connections to all the other AuthorizeNet api's already and now I'm trying to use the new DPM method.  Unfortunately, the sandbox gives you no "debug" information on errors.  It just says transaction can't process, go fish.  I have a very simple form that should be working and nothing obvious that should be a problem.

 

Here is the form page below. Note to_hash is simply debug code to show me the string that needs to be fingerprinted and it looks good to go.  I'm using authorizeNet's EncryptHMAC function.  I did rewrite it to vb.net but it seems to be functioning correctly from what I can tell.

 

Can someone please tell me why this is not working?

 

<!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><title>
	testing
</title></head>
<body>
 
<form id='secure_redirect_form_id' action='https://test.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='1.99' />
<br />
<input type='hidden' name='x_invoice_num' 
value='14' />
<input type='hidden' name='x_relay_url' value='http://www.microsoft.com' />
<input type='hidden' name='x_login' value='6P8aEm5q' />
 
<input type='hidden' name='x_fp_sequence' value='14' />
<input type='hidden' name='x_fp_timestamp' value='1353539796' />
<input type='hidden' name='x_fp_hash' value='1f2918442389819905ef8467f438b4c0' />
<input type='hidden' name='to_hash' value='6P8aEm5q^14^1353539796^1.99^' />

<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_CAPTURE' />
<input type='hidden' name='x_amount' value='1.99' />
<input type='hidden' name='x_test_request' value='TRUE' />
<input type='hidden' name='notes' value='extra hot please' />
<input type='submit' name='buy_button' value='BUY' />
</form>
</body>
Direct Post Method Developer Guide | November 2012
70
</html>

 P.S.  fix your gateway to spit out debug details.  It is a sandbox so there is nothing secret about having the sandbox tell you what is wrong "generically" with the post.

spastic
Contributor
13 REPLIES 13

Ok, well I'm not following that because a plain .html page will accept a form post, it just will ignore everything else in the post.  I don't see how AuthorizeNet can really investigate the relay.  I would think it simply posts data to the relay page and moves on.

 

However, I set up a page that could take a form post and I am still getting an error.  The page simply spits out a few things

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="AuthRelay.aspx.vb" Inherits="SinglePageCO.AuthRelay" %>

<!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 runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        Thank you<br />
        You have arrived<br />
        <asp:Label ID="LblResponseCode" runat="server" Text="Label"></asp:Label>
        <br />
        <asp:Label ID="LblRespReason" runat="server" Text="Label"></asp:Label>
        <br />
        <asp:Label ID="LblTranCode" runat="server" Text="Label"></asp:Label>
        <br />
        <asp:Label ID="LblAuthCode" runat="server" Text="Label"></asp:Label>
        <br />
        <asp:HyperLink ID="HLkRedirect" runat="server">Click to Continue</asp:HyperLink>
    
    </div>
    </form>
</body>
</html>

 Codebehind

Public Class AuthRelay
    Inherits System.Web.UI.Page
    Dim ResponseCode As String = Trim(Request.Form("x_response_code"))
    Dim ResponseReasonText As String = Trim(Request.Form("x_response_reason_text"))
    Dim ResponseReasonCode As String = Trim(Request.Form("x_response_reason_code"))
    Dim AVS As String = Trim(Request.Form("x_avs_code"))
    Dim TransID As String = Trim(Request.Form("x_Trans_ID"))
    Dim AuthCode As String = Trim(Request.Form("x_Auth_Code"))
    Dim Amount As String = Trim(Request.Form("x_Amount"))
    Dim ReceiptLink As String = "http://www.authorizenet.com"

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        LblResponseCode.Text = ResponseCode
        LblRespReason.Text = ResponseReasonText
        LblAuthCode.Text = AuthCode
        LblTranCode.Text = TransID
        HLkRedirect.NavigateUrl = ReceiptLink
    End Sub

End Class

 Your link http://developer.authorize.net/downloads/samplecode/ has a sample .asp relay response...I'm going to try that one next.  It is classic asp but should work on this server.

for asp.net set EnableViewStateMac="false" on both page the post to authorize.net and the relay response page.

Ok, actually it appears I just had an error in my code. 

That was really awesom but now coudl you please recommend me the best way to find the site age if you know then please let me know. thanks

simplybuzzes
Member