2014-10-10 87 views
-1

我有一個用VB.net編寫的web應用程序。我通過貝寶實施了付款。 當我通過電腦付款時沒有問題,但是當我通過手機進行付款時,我遇到了一些問題。 我無法閱讀返回頁面上的貝寶參數。 我使用httpwebrequest從paypal讀取信息,但變量request.form是空的,所以響應是「無效」。PayPal POST付款不適用於移動瀏覽器

有誰可以幫助我?請...

+0

我們將要看看你的代碼才能夠搞清楚這是怎麼回事... – 2014-10-10 19:59:37

+0

嗨,你見過我的代碼?你知道我在哪裏錯了嗎? – 2014-10-15 10:25:08

回答

0

這是我的代碼:

 Dim objHttp As HttpWebRequest 

     objHttp = WebRequest.Create("https://www.sandbox.paypal.com/cgi-bin/webscr") 
      objHttp.Method = "POST" 

     objHttp.ContentType = "application/x-www-form-urlencoded" 

     Dim param As Byte() = Request.BinaryRead(HttpContext.Current.Request.ContentLength) 
     Dim strRequest As String = Encoding.ASCII.GetString(param) 
     Dim ipnPost As String = strRequest 

     strRequest += "&cmd=_notify-validate" 
     objHttp.ContentLength = strRequest.Length 

     'Send the request to PayPal and get the response 
     Dim streamOut As New StreamWriter(objHttp.GetRequestStream(), System.Text.Encoding.ASCII) 
     streamOut.Write(strRequest) 
     streamOut.Close() 

     Dim streamIn As New StreamReader(objHttp.GetResponse().GetResponseStream()) 
     Dim strResponse As String = streamIn.ReadToEnd() 
     streamIn.Close() 

     Dim myHttpWebResponse As HttpWebResponse = CType(objHttp.GetResponse(), HttpWebResponse) 

     Dim strIdTransazione = Request.Form("txn_id") 
     Dim strDscTransazione = Request.Form("payment_status") 

     'HttpStatusCode.myHttpWebResponse.StatusCode() 

     If myHttpWebResponse.StatusCode <> HttpStatusCode.OK Then 

     Else 

     end if 
相關問題