cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to get DPM to work on MVC

I am new to both MVC and Authorize.net so I apologize in advance for a possible simple question.  I am trying to get a version of the 15 minute demo up and runing with an MVC application I have developed.  I have written a view that I believe should submit a DPM request to Authorize.net but when I click on the "Process Payment" button nothing happens.  No error, no timeout, nothing? 

 

Any advice, recommendations, or identification of a simple mistake will be greatly appreciated.

 

Here is my view code:

 

@model TCPA.Models.CCProcessingModel

@using AuthorizeNet;
@{
    ViewBag.Title = "Register->Payment";
}

<hgroup class="title">
    <h1>@ViewBag.Title.</h1>
    <h2>Credit Card Information</h2>
</hgroup>

  
@DPMFormGenerator.OpenForm("REMOVED API LOGIN", "REMOVED TRANSACTION KEY", 99.99m, "REMOVED RESPONSE URL",true)

    <fieldset>
        <legend>Credit Card Information Form</legend>
        <table>
            <tr>
                <td>
                    @Html.LabelFor(m => m.x_card_num)
                    @Html.TextBoxFor(m => m.x_card_num, new { @autofocus = "autofocus" })
                    @Html.ValidationMessageFor(m => m.x_card_num)
                </td>
            </tr>
            <tr>
                <td>
                    @Html.LabelFor(m => m.x_exp_date)
                    @Html.TextBoxFor(m => m.x_exp_date)
                </td>
            </tr>
            <tr>
                <td>
                    @Html.LabelFor(m => m.x_card_code)
                    @Html.TextBoxFor(m => m.x_card_code)
                </td>
            </tr>
            <tr>
                <td>
                    @Html.LabelFor(m => m.AnnualFee)
                    @Html.TextBoxFor(m => m.AnnualFee)
                </td>
            </tr>
            <tr>
               <td>
                    @Html.LabelFor(m => m.DiscountCode)
                    @Html.TextBoxFor(m => m.DiscountCode)
                    @Html.ActionLink("Apply Discount", "CCDiscount", "Account",
                    new { id = "Model" }, null)
            </tr>
            <tr>
                <td>
                    <div style="clear:both"></div>
                    <input type="submit" class="submit "value="Process Payment" />
                </td>
            </tr>
            <tr>
                <td>
                    <h3>Clicking on the "Process Payment" button will charge your credit card in the amount listed as the Annual Fee.</h3>
                </td>
            </tr>
        </table>
    </fieldset>
@DPMFormGenerator.EndForm()
}

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}

 

jwkuvera
Member
12 REPLIES 12

After you click the button, did the url in the address bar change?

Can you look into the page source in the web browser to see if it posting to authorize.net?

Did you use the broswer developer tools to look at the http traffic?

RaynorC1emen7
Expert

Thanks for your response.

 

What I have done is to view the source in a browser and pull out the html form data.  I took that data and posted it directly to the Authorize.net site (https://secure.authorize.net/gateway/transact.dll) by using Chrome Poster.  From Chrome Poster I get the following response:

 

Response:

status: 200 OK
  • Date: Wed, 22 Jul 2015 14:17:19 GMT
  • Server: Microsoft-IIS/7.5
  • X-Powered-By: ASP.NET
  • Content-Type: text/html
  • Cache-Control: private, must-revalidate, max-age=0
  • Connection: close
  • Content-Length: 151
  • Expires: Tue, 01 Jan 1980 00:00:00 GMT

 

<HTML><BODY><H3>The following errors have occurred.</H3>(13) The merchant login ID or password is invalid or the account is inactive.<BR></BODY></HTML>
 
This obviously suggests my login is not correct.  So I went into the Authorize.net site and generated a new transaction ID and tried again, still the same message.  I don't know if this error is a true reflection of the problem or if it is an indication of a more general problem.  Here is the form I am posting (with the login ID and relay URL removed):
 
<form action = 'https://test.authorize.net/gateway/transact.dll' method = 'post'> <input type = 'hidden' name = 'x_fp_hash' value = 'f5f2f4b398446f95e2f4435f05ff4bdd' /> <input type = 'hidden' name = 'x_fp_sequence' value = '7612065' /> <input type = 'hidden' name = 'x_fp_timestamp' value = '1437542147' /> <input type = 'hidden' name = 'x_login' value = '************' /> <input type = 'hidden' name = 'x_amount' value = '99.99' /> <input type = 'hidden' name = 'x_relay_url' value = 'http://www.*****.****' /> <input type = 'hidden' name = 'x_relay_response' value = 'TRUE' /> </form>
 
I have sent an email to the Authorize.net developers email address listed on the "Contact" page but I have not yet received a response.
 
Seeing the "15 minute" demo sample gave me hope this was going to be easy but I am having doubts.
 
I would appreciate any other thoughts or suggestions, but for now I guess I wait to hear back regarding my login ID to the Sandbox environment.
 
 
 
 
jwkuvera
Member

Do you have a sandbox test account or production account?

secure.authorize.net url is for production account only.

need the test.authorize.net url

Expanding on what @RaynorC1emen7 said, an API Login and Transaction key created in the sandbox (https://sandbox.authorize.net) cannot be used on a production endpoint or visa versa.

 

Richard

Yes, I have tried both "test.authorize..." and "secure.authorize..." with the same results.  I had read something that said depending on how the account was setup it may have been setup on the production site so I tried that just to be sure but both sites are returning the same error message.

 

I have switched back to the test site exclusively for futher testing but I am still getting the same message.

I canot help but wonder if this is something in the <form> data as opposed to a user ID problem.  When I hit the URL https://test.authorize.net/gateway/transact.dll directly from my browser I get the exact same response message.  Is there something wrong with the form data I am posting?

 

<form action = 'https://test.authorize.net/gateway/transact.dll' method = 'post'> <input type = 'hidden' name = 'x_fp_hash' value = 'f5f2f4b398446f95e2f4435f05ff4bdd' /> <input type = 'hidden' name = 'x_fp_sequence' value = '7612065' /> <input type = 'hidden' name = 'x_fp_timestamp' value = '1437542147' /> <input type = 'hidden' name = 'x_login' value = '5899f2Aa3QUH' /> <input type = 'hidden' name = 'x_amount' value = '99.99' /> <input type = 'hidden' name = 'x_relay_url' value = 'http://kuvera.cloudapp.net/TCPA/Account/AuthorizeResponse' /> <input type = 'hidden' name = 'x_relay_response' value = 'TRUE' /> </form>

Use id instead of name. or better yet use both

e.g. <input type = 'hidden' id = 'x_fp_hash'  name = 'x_fp_hash' value = 'f5f2f4b398446f95e2f4435f05ff4bdd' />

I added id to all of the input fields and no change.

 

However, I am convinced the problem is not related to the login ID.  In the API reference guide (http://developer.authorize.net/api/reference/) I found a test page where you can enter in your login ID and transaction ID to generate an XML request and test the credentials.  When I do so, I get a successful response suggesting the credentials I am using are correct.

 

 

So now I have created an entirely new project with just the simple Authorize.net test case.  I generate a new transaction ID just to be save.  When I view source on the test page I get a very simple HTML page - see below:

 

<html><form action = 'https://test.authorize.net/gateway/transact.dll' method = 'post'>

<input type = 'hidden' name = 'x_fp_hash' value = '15235f47072c27111c3f175fa0249523' />

<input type = 'hidden' name = 'x_fp_sequence' value = '1788625' />

<input type = 'hidden' name = 'x_fp_timestamp' value = '1437582718' />

<input type = 'hidden' name = 'x_login' value = ''**********' ' />

<input type = 'hidden' name = 'x_amount' value = '2.25' />

<input type = 'hidden' name = 'x_relay_url' value = 'http://http://localhost:51850/Home/About/DPMResponse' />

<input type = 'hidden' name = 'x_relay_response' value = 'TRUE' />

<p><div style='float:left;width:250px;'><label>Credit Card Number</label><div id = 'CreditCardNumber'><input type='text' size='28' name='x_card_num' value='4111111111111111' id='x_card_num'/></div></div><div style='float:left;width:70px;'><label>Exp.</label><div id='CreditCardExpiration'><input type='text' size='5' maxlength='5' name='x_exp_date' value='0116' id='x_exp_date'/></div></div><div style='float:left;width:70px;'><label>CCV</label><div id='CCV'><input type='text' size='5' maxlength='5' name='x_card_code' id='x_card_code' value='123' /></div></div></p><div style='clear:both'></div><p><input type='submit' class='submit' value='Order with DPM!' /></p></form></html>

 

I click on the "Order with DPM!" button and get the response:

 

<HTML><BODY><H3>The following errors have occurred.</H3>(13) The merchant login ID or password is invalid or the account is inactive.<BR></BODY></HTML>

 

When I copy the HTML form show above and test it through Chrome Poster I get the same response.  Perhaps this testing approach through Chrome Poster will not work due to the x_fp_hash value that is being generated?  Regardless, clicking on "Order with DPM!" button also fails - and I would expect that approach to work properly.

 

I want to emphasize, I am running the code as provided by Authorize.net in their sample application.  I am now 2 days into a "15 minute" project.  I have no doubt this is a simple problem, likely caused by me, but I am out of patience and time.  I think Authorize.net just lost a future customer.