【问题标题】:PayPal IPN issue for notify用于通知的 PayPal IPN 问题
【发布时间】:2013-04-06 16:09:46
【问题描述】:

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

tx=1******X&st=Completed&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 而不是其余参数。

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

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

谢谢

【问题讨论】:

    标签: vb.net paypal paypal-ipn


    【解决方案1】:

    我整理了一下,过程没看懂,现在就做

    【讨论】:

      猜你喜欢
      • 2011-02-17
      • 2014-02-05
      • 1970-01-01
      • 1970-01-01
      • 2016-02-19
      • 2014-05-02
      • 1970-01-01
      • 2020-08-29
      • 2016-06-10
      相关资源
      最近更新 更多