iPay88(支付网关)与ASP.net集成

时间:2018-04-16 10:18:04

标签: asp.net http payment-gateway

我正在ASP.NET中开发一个电子商务应用程序,它正在集成支付网关。

我使用HTTP POST方法将参数传递给REQUEST URL,如下所示,但它不会重定向到iPay88的付款方式。

Protected Sub btnPaymemt_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnPaymemt.Click

    Dim request As HttpWebRequest = WebRequest.Create("https://xxxxxxx/xxxx.aspx?")

    Dim strParam As String = ""
    strParam += "MerchantCode=MXXXX0&"
    strParam += "PaymentId=&"
    strParam += "RefNo=POS00123&"
    strParam += "Amount=5200&"
    strParam += "Currency=MYR&"
    strParam += "ProdDesc=Photo Print&"
    strParam += "UserName=XXXXXXX&"
    strParam += "UserEmail=XXXXXX&"
    strParam += "UserContact=XXXXXX&"
    strParam += "Remark=&"
    strParam += "Lang=UTF-8&"
    strParam += "SignatureType=SHA256&"
    strParam += "Signature=ccd199c8a06ff585f7c2541ba1d804d9467dabe8ec147aa2efb7acb077691641&"
    strParam += "ResponseURL=../Members/responseurl.aspx&"
    strParam += "BackendURL=../Members/backendurl.aspx"

    Dim data = Encoding.ASCII.GetBytes(strParam)
    request.Method = "POST"
    request.ContentLength = data.Length

    Using stream = request.GetRequestStream()
        stream.Write(data, 0, data.Length)
    End Using

    Dim response As HttpWebResponse = request.GetResponse
    Dim strResponse = New StreamReader(response.GetResponseStream()).ReadToEnd()

End Sub

你知道可能是什么原因吗?

1 个答案:

答案 0 :(得分:0)

对于使用ipay88的付款交易,您需要使用ipay88注册测试帐户并向他们提供您的响应和后端网址,并且它也不允许使用localhost进行测试希望这对您有所帮助。