0

我已经设置了一个 PDT 表单,它正在工作并收集付款,然后使用以下参数返回到适当的 url

tx=1* * *** *X&st=已完成&amt=0.02&cc=GBP&cm=&item_number=NA

我正在使用以下示例代码:

Dim strSandbox As String = "https://www.sandbox.paypal.com/cgi-bin/webscr"
    Dim strLive As String = "https://www.paypal.com/cgi-bin/webscr"
    Dim req As HttpWebRequest = CType(WebRequest.Create(strLive), HttpWebRequest)

    'Set values for the request back
    req.Method = "POST"
    req.ContentType = "application/x-www-form-urlencoded"
    Dim Param() As Byte = Request.BinaryRead(HttpContext.Current.Request.ContentLength)
    Dim strRequest As String = Encoding.ASCII.GetString(Param)
    strRequest = strRequest & "&cmd=_notify-validate"
    req.ContentLength = strRequest.Length

    'for proxy
    'Dim proxy As New WebProxy(New System.Uri("http://url:port#"))
    'req.Proxy = proxy

    'Send the request to PayPal and get the response
    Dim streamOut As StreamWriter = New StreamWriter(req.GetRequestStream(), Encoding.ASCII)
    streamOut.Write(strRequest)
    streamOut.Close()
    Dim streamIn As StreamReader = New StreamReader(req.GetResponse().GetResponseStream())
    Dim strResponse As String = streamIn.ReadToEnd()
    streamIn.Close()

    If strResponse = "VERIFIED" Then
        'check the payment_status is Completed
        'check that txn_id has not been previously processed
        'check that receiver_email is your Primary PayPal email
        'check that payment_amount/payment_currency are correct
        'process payment
        lit1.Text = "verified"
    ElseIf strResponse = "INVALID" Then
        'log for manual investigation
        lit1.Text = "invalid"
    Else
        'Response wasn't VERIFIED or INVALID, log for manual investigation
        lit1.Text = "unknown"
    End If
    lit1.Text = lit1.Text & "<br /><br />" & strRequest.ToString

我只收到无效响应,所以我试图查看发送到 Paypal 的内容,但它只发送 &cmd=_notify-validate 而不是其余参数。

所以我手动添加了参数,但仍然无效。

有人可以帮忙解决我所缺少的吗?支付成功

谢谢

4

1 回答 1

0

我排序了,我不明白这个过程,但现在做

于 2013-04-14T22:08:18.027 回答