查看完整版本: 想到頭快要炸掉了... Paypal
頁: [1]

lvben1 發表於 2010-2-2 09:04 PM

想到頭快要炸掉了... Paypal

請教各位前輩
本人目前開發購物車~
想結合Paypal
但是><當啟用Paypal IPN
想做到接收最後User付完錢後,點下 Return to Merchant 按紐
指到我的驗證頁....ChrckPaypal.aspx

Code Snippet
Imports System.Net
Imports System.IO
Partial Class CheckPaypal
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'Dim numbers As String = Request.QueryString("Item_number")
'Response.Write(numbers)
'Post back to either sandbox or live
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(strSandbox), 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()
Response.Write(strResponse)
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
Response.Write("VERIFIED")
ElseIf strResponse = "INVALID" Then
'log for manual investigation
Response.Write("VERIFIED")
Else
'Response wasn't VERIFIED or INVALID, log for manual inverstigation
Response.Write("ERROR")
End If
End Sub
End Class



可是很神奇....都沒有值傳過來
網頁直接Response.Write("ERROR")
不知是否有前輩也曾經遇到過這問題..
麻煩各位前輩指導...感恩
我會非常感謝您~~~OH~~~~...<div class='locked'><em>瀏覽完整內容,請先 <a href='member.php?mod=register'>註冊</a> 或 <a href='javascript:;' onclick="lsSubmit()">登入會員</a></em></div><div></div>

lemon223 發表於 2010-2-2 09:50 PM

雖然不太懂你要寫的是什麼
但是你的程式代的參數有點問題
頁: [1]