0
我已將我的網站重定向到了位於Buy Now
的PayPal按鈕,但是在交易成功完成後,我應該在哪裏放置我的代碼。 有人可以幫忙嗎?我需要改變自己的待遇狀態。貝寶確認交易成功完成後
Dim temp As String = Request.QueryString("user").ToString
Dim temp1 As Integer = Convert.ToInt32(temp)
Dim LastName As String
Dim WinningPrice As String
Dim email As String
Dim country As String
Dim Name As String
Dim FirstName As String
Using con1 As New SqlConnection(_start)
'Build your SQL String'
Dim sql1 As String = "SELECT Item.Name, BID.WinningPrice, Member.LastName, Member.FirstName,Member.Email, Member.Country FROM Item INNER JOIN Seller ON Item.SellerID = Seller.SellerID INNER JOIN Auction ON Item.ItemID = Auction.ItemID INNER JOIN BID ON Auction.AuctionID = BID.AuctionID INNER JOIN Member ON Seller.MemberID = Member.MemberID WHERE (Member.Status = 'Available') AND (Seller.SellerStatus = 'Available') AND (BID.Status = 'Won') AND (Auction.Status = 'Expired') and [email protected]"
'Open your connection'
con1.Open()
'Build your Command to execute'
Dim myCommand1 As New SqlCommand(sql1, con1)
'Grab your parameter'
'Add your parameter'
myCommand1.Parameters.Add("@bidid", SqlDbType.Int).Value = temp1
Dim reader As SqlDataReader = myCommand1.ExecuteReader()
If reader.HasRows Then
If reader.Read() Then
' etc
Name = reader.GetString(0)
WinningPrice = Convert.ToString(reader.GetDouble(1))
LastName = reader.GetString(2)
FirstName = reader.GetString(3)
email = reader.GetString(4)
country = reader.GetString(5)
Dim price As Object
'Converting String Money Value Into Decimal
price = Convert.ToDouble(WinningPrice)
'declaring empty String
Dim returnURL As String = ""
returnURL += "https://www.paypal.com/xclick/business=" + email
'Passing Item Name as dynamic
returnURL += Convert.ToString("&item_name=") & Name
'Assigning Name as Statically to Parameter
returnURL += Convert.ToString("&first_name") & FirstName
'Assigning Name as Statically to Parameter
returnURL += Convert.ToString("&last_name") & LastName
'Assigning City as Statically to Parameter
returnURL += Convert.ToString("&country") & country
'Passing Amount as Dynamic
returnURL += "&amount=" + price.ToString
'Passing Currency as your
returnURL += "¤cy=USD"
'If transactioin has been successfully performed, redirect SuccessURL page- this page will be designed by developer
returnURL += "&return=" + ConfigurationManager.AppSettings("SuccessURL").ToString()
'retturn Url if Customer Wants To Cancel the Transaction
'If transactioin has been failed, redirect FailedURL page- this page will be designed by developer
returnURL += "&cancel_return=" + ConfigurationManager.AppSettings("FailedURL").ToString()
Response.Redirect(returnURL)
End If
End If
End Using
但是會否成功通過他觸發的bidid,以便我可以設置要支付的出價? – user3287068
,但是會否成功通過他觸發的bidid,以便我可以設置出價付款?真的我的問題是如何將已成功出價的ID傳遞給SucessUrl,以便我可以獲得出價的ID並將其狀態更改爲付費 – user3287068
您應該可以將bidid作爲參數添加到sucessurl中,所以如果你傳遞了mysuccesspage.aspx?bidid = 12345,它應該用附加的自定義參數回叫你。 –