HttpWebRequest.GetResponse 从支付网关返回 html 标签

HttpWebRequest.GetResponse returning html tag from payment gateway

我正在尝试将支付网关集成到我的 asp.net 网络中 link (https://docs.payfort.com/docs/merchant-page-two/build/index.html)。

以下是我的示例代码:

protected void btnPay_Click(object sender, EventArgs e)
{
    ASCIIEncoding encoding = new ASCIIEncoding();
    string data = string.Format("service_command={0}&access_code={1}&merchant_identifier={2}&merchant_reference={3}&language={4}&signature={5}&token_name={6}&expiry_date={7}&card_number={8}&card_security_code={9}&card_holder_name={10}&remember_me={11}&return_url={12}",
        "TOKENIZATION", "zx0IPmPy5jp1vAz", "CycHZxVj", "XYZ9239-yu898","en", "d7c185c475ac0e3", "Op9Vmp", "1705", "4005550000000001","123", "John Smith","NO", "http://localhost:1093/Default.aspx");
    byte[] bytes = encoding.GetBytes(data);

    System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;

    HttpWebRequest httpRequest = (HttpWebRequest)WebRequest.Create("https://sbcheckout.payfort.com/FortAPI/paymentPage");
    httpRequest.Method = "POST";
    httpRequest.ContentType = "application/x-www-form-urlencoded";
    httpRequest.ContentLength = bytes.Length;
    using (Stream stream = httpRequest.GetRequestStream())
    {
        stream.Write(bytes, 0, bytes.Length);
        stream.Close();
    }
    StreamReader rdr = new StreamReader(httpRequest.GetResponse().GetResponseStream());
    string result = rdr.ReadToEnd();
    rdr.Close();
    httpRequest.GetResponse().Close();
}

enter image description here

现在我不明白的是,我得到的响应与我的页面相同 HTML,其中包含表单标记的 action 属性中的所有参数,我不知道这是什么和我和它有什么关系。谁能帮我解决这个问题。 我附上了我收到的回复,也请看一下

谢谢

click on the link to view response

文档指出:

Remember - The Merchant should develop a form that does not send data to his website but directly submits the form to PayFort.

你正在做他们要求你做的事情而不是

我认为这不应该用作 API。您的表格应该将信息直接提交给他们的系统。然后他们将使用 return_url 参数来显示您工作流程中的下一页。 URL 将包含结果的详细信息。

您可以随时与他们联系并要求提供替代的、后端友好的集成。