从我的网站通过paypal付款

时间:2013-03-08 07:52:42

标签: asp.net paypal

我正在尝试实施一种机制,从我的网站获取购买数据并在Paypal上处理它。

我正在使用这个课程:

Public Class RedirectToPaypal
    Public Shared Function getItemNameAndCost(ByVal itemName As String, ByVal itemCost As String) As String

        'Converting String Money Value Into Decimal
        Dim price As Decimal = Convert.ToDecimal(itemCost)

        'declaring empty String
        Dim returnURL As String = ""

        returnURL += "https://www.paypal.com/xclick/business=vitisha2012@hotmail.com"

        'PassingItem Name as dynamic
        returnURL += "&item_name=" & itemName

        'AssigningName as Statically to Parameter
        returnURL += "&first_name" & "raj"

        'AssigningCity as Statically to Parameter
        returnURL += "&city" & "Port-Louis"

        'Assigning State as Statically to Parameter
        returnURL += "&state" & "Port-Louis"

        'Assigning Country as Statically to Parameter
        returnURL += "&country" & "Mauritius"

        'Passing Amount as Dynamic
        returnURL += "&amount=" & price

        'Passing Currency as your
        returnURL += "&currency=USD"

        'retturn Url if Customer wants To return to Previous Page
        returnURL += "&return=http://emsonline.somee.com/cancel.aspx"

        'retturn Url if Customer Wants To Cancel the Transaction
        returnURL += "&cancel_return=http://emsonline.somee.com/cancel.aspx"

        Return returnURL

    End Function
End Class

我添加了一个临时按钮用于测试目的,使用以下例程:

Protected Sub btnpay_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnpay.Click
        Dim itemName As String = txtitem.Text
        Dim itemCost As Decimal = txtprice.Text

        Dim responseURL As String = RedirectToPaypal.getItemNameAndCost(itemName, itemCost)
    End Sub

没有错误消息,但什么也没发生。

0 个答案:

没有答案