Member
Posts: 2
Registered: ‎03-18-2014
Direct Post with Razor and MVC 4

I am attempting to convert the quick start sample for Direct Post for use with Razor (MVC 4)  and running into some problems.  The main one right now is that Html.BeginSIMForm seems to render the form at the top of the page (above the DOCTYPE tag) and does not enclose the "order_id" hidden input or the submit button.

 

Any suggestions?

 

Here's my code:

 

        @using (Html.BeginSIMForm(

                    Model.ResponseUrl,

                    Model.AuthorizationRequest.Amount,

                    Model.AuthorizationRequest.Credentials.LoginId,

                    Model.AuthorizationRequest.Credentials.TransactionKey,
                    Model.AuthorizationRequest.Credentials.IsTestMode))
  {

            @Html.Raw( @Html.CheckoutFormInputs(true))

            @Html.Hidden("order_id",Model.AuthorizationRequest.OrderId)

          

      <input type="submit" value="Submit Payment"/>

 

   }

 

Renders this:

 

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

<input type='hidden' name='x_fp_hash'value='-- Value removed --' \>

<input type='hidden' name='x_fp_sequence'value='146'\>

<input type='hidden' name='x_fp_timestamp'value='1395158912' \>

<input type='hidden' name='x_login'value='MYLOGINHERE' \>

<input type='hidden' name='x_amount'value='50.0' \>

<input type='hidden' name='x_relay_url'value='http://localhost:49358/payment/sim' \>

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

</form><!DOCTYPE html>

 

Who Me Too'd this topic