我在视图中有以下硬编码形式:
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="business" value="mymail@mymail.com" />
<input type="hidden" name="item_name" value="Attack Announcer" />
<input type="hidden" name="item_number" value="2ca168a959bb48e28a2ddb4b4640c568" />
<input type="hidden" name="amount" value="0.01" />
<input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="return" value="?????" />
<input type="hidden" name="cancel_return" value="?????" />
<input type="hidden" name="notify_url" value="??????" />
<input type="hidden" name="no_note" value="1" />
<input type="image" name="submit"
src="https://www.sandbox.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif"
alt="PayPal — The safer, easier way to pay online." />
<img src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif"
width="1" height="1" alt="" />
</form>
如何在事务完成后(在localhost上)获取响应消息? 例如,如果我有一些动作,如:
[HttpPost]
public ActionResult PaypalConfirmation(???????????)
{
// ........................
return View();
}
答案 0 :(得分:0)
你必须告诉它成功的url和失败的url,在成功交易上去了这个url并且在失败的交易中转到这个url,你必须通过 return 的隐藏字段传递url和 cancel_return :
<input type="hidden" name="return" value="@Url.Action("ActionName","ControllerName")" />
<input type="hidden" name="cancel_return" value="@Url.Action("ActionName","ControllerName")" />