cancel
Showing results for 
Search instead for 
Did you mean: 

Trouble getting started with SIM in an ASP.Net MVC project

Hi all,

I'm testing the waters with integration in a simple MVC project while I wait for my accounting team to finish our account authorization.

 

Unfortunately, I'm having trouble getting the compiled page to output the correct HTML.  I basically copy/pasted the sample code from

https://developer.authorize.net/integration/fifteenminutes/csharp#hosted , then modified it to build with my project.  The only difference from the sample is that I'm using Razor markup. The page looks like this:

 

@{
    ViewBag.Title = "First Test";
}
 
<h1>@ViewData["message"]</h1>
 
@using (Html.BeginSIMForm("http://YOURSERVER.com/home/sim", 1.99M, "YOUR_API_LOGIN_ID",
    "YOUR_TRANSACTION_KEY"true))
{
   @Html.Raw(Html.CheckoutFormInputs(true));
 
   @Html.Hidden("order_id","1234");
                                  
   <input type = "submit" value = "Pay" />
}


This looks like it should be all fine and dandy, but the problem seems to be with the "BeginSIMForm" helper: the <form>...</form> block gets output before everything else on the page, so when looking at the html on the rendered page, I see the form block up top, then the DOCTYPE, html, head, body, etc.

 

I tried replacing BeginSIMForm with just a basic BeginForm, and if I do that, the form is rendered in the body of the page, as one would expect.

 

Is there something special I need to do to get this to work, or will the HtmlHelpers just not work with MVC3/Razor markup?  If not, that might be something worth documenting somewhere (or at least, that they only work with ASP markup).

 

I appreciate any feedback I might get on this.

 

 

MRussell
Member
11 REPLIES 11

all right.  I've had a look at the source code for CheckoutFormBuilders.  what garbage.  I'm ripping the DLL out of my project and will code it by hand.

 

- e

 

p.s. as a side note, SIM doesn't support eChecks which was the whole reason for this exercise... sigh...

I have a detailed answer to this on stackoverflow

 

http://stackoverflow.com/a/8426501/1087034

 

As others mentioned add a @using statement to the top of your view to AuhtorizeNET.Helpers or in the web.config located in /Views

 

This made it so I could render the forms correctly and test the DPM suite.

 

 

epicthreedev
Member