如何在dotnet MVC 4源代码中的WorldPay支付集成中动态传递参数

时间:2013-10-08 11:17:17

标签: c# asp.net-mvc worldpay

我在视图中尝试了这个,但是工作正常,但无法从控制器动态传递这些静态参数,任何MVC专家朋友请帮助我解决我的问题,我将非常感谢您的帮助。

查看代码:

<form action="https://secure-test.worldpay.com/wcc/purchase" name="BuyForm" method="POST">
<input type="hidden" name="instId"  value="211616"><!-- The "instId" value "211616" should be replaced with the Merchant's own installation Id -->
<input type="hidden" name="cartId" value="abc123"><!-- This is a unique identifier for merchants use. Example: PRODUCT123 -->
<input type="hidden" name="currency" value="GBP"><!-- Choose appropriate currency that you would like to use -->
<input type="hidden" name="amount"  value="400">
<input type="hidden" name="desc" value="Product-1,Product-2,Product-3,Product-4">
<input type="hidden" name="testMode" value="100">

<input type="submit" value="submit" />
</form>

1 个答案:

答案 0 :(得分:0)

尝试使用基于模型的视图,如下所示

@model Merchant

@using (Html.BeginForm("action","controller",htmlAttr))
{

@Html.HiddenFor(m=>m.InstallationId);
//etc

}