[庫存區]

購物車有問題... Paypal

本帖最後由 danielpaggy 於 2010-2-2 13:48 編輯

請教各位前輩

小弟目前開發購物車~

想結合Paypal

無奈..前面都很ok

但是當小弟啟用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")

不知是否有前輩也曾經遇到過這問題..

麻煩各位前輩指導...感恩
喜歡這篇文章嗎?
回覆 3
您需要登入後才可以回帖 登入 | 註冊會員

本版積分規則 回覆 15 個字以上可拿獎勵,
規則詳見此

精選熱門商品

提示訊息
go_top