好的,所以我正在尝试使用带有PaymentID的PHP进行重定向...我不知道该怎么做...这里有说明甚至是一些示例asp.net代码来帮助
重定向到Mercury HostedCheckout页面 Mercury HostedCheckout URL:测试网址:https://hc.mercurydev.net/Checkout.aspx
HTML表单中的隐藏字段发布到HostedCheckout
Field Name Description Required
PaymentID The unique identifier returned by the InitiatePayment web service. Yes
以下是C#for asp.net
中的示例代码重定向示例代码 这是将浏览器重定向到Mercury的HostedCheckout页面的示例代码。它是在asp.net点击事件中使用的服务器端C#代码,它创建一个将重定向到Mercury的html响应。
//Set the necessary variables before building html.
string hostedCheckoutURL = ConfigurationManager.AppSettings["HostedCheckoutURL"];
string paymentID = this.txtPaymentID.Text;
//Build an html form post to be sent back to the browser.
//It will redirect the browser to the Mercury HostedCheckout page.
Response.Clear();
Response.Write("<html><head>");
Response.Write("</head><body onload=\"document.frmCheckout.submit()\">");
Response.Write("<form name=\"frmCheckout\" method=\"Post\" action=\"" + hostedCheckoutURL + "\" >");
Response.Write("<input name=\"PaymentID\" type=\"hidden\" value=\"" + paymentID + "\">");
Response.Write("</form>");
Response.Write("</body></html>");
Response.End();
基本上我需要在PHP中做同样的请求......任何想法
答案 0 :(得分:3)
你必须include("config.php");
或者这样才能获得$ hostedCheckoutURL,但我不知道你从哪里得到PaymentID。
<?php
//Set the necessary variables before building html.
$hostedCheckoutURL = "https://hc.mercurydev.net/Checkout.aspx";
$paymentID = "123456789";
//Build an html form post to be sent back to the browser.
//It will redirect the browser to the Mercury HostedCheckout page.
echo("<html><head>");
echo("</head><body onload=\"document.frmCheckout.submit()\">");
echo("<form name=\"frmCheckout\" method=\"Post\" action=\"".$hostedCheckoutURL."\" >");
echo("<input name=\"PaymentID\" type=\"hidden\" value=\"".$paymentID."\">");
echo("</form>");
echo("</body></html>");
?>