2013-04-14 55 views
0

我已經設置了PDT形式和工作,並收取費用,然後返回到相應的URL與後續的參數貝寶IPN問題的通知

TX = 1 * * *** * X & ST =完成& AMT = 0.02 & CC = GBP &釐米= & 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 

我只收到一個無效的響應,所以我想看看發生了什麼被髮送到貝寶,但其只發送& CMD = _notify-驗證,而不是參數的其餘部分。

所以我手動添加到參數,但仍只得到無效。

可能有人請幫助我缺少的是什麼?付款成功

感謝

回答

0

我整理它,我不明白的過程,但現在做