www.webdeveloper.com
Results 1 to 4 of 4

Thread: Help with PayPal input code

  1. #1
    Join Date
    Nov 2012
    Posts
    2

    Help with PayPal input code

    Guys, I have this code that almost works. First of all I am using Windows7, SQL server 2008, Visual Studio 2010 and VB.NET. I am also using iFrames on the site.
    The code encloded works to a point, it opens the PayPal screen and carries forward the OrderID (SQL CartID) and the total number of items in the basket (Session("BasketSum")) However I cannot get the important bit across "THE MONEY!". The amount just does not work. I have tried taking out the string.format bit but the amount is just not transferred and I have tried taking out the item_ part of the statement as the book I am using suggests but PayPal comes back with an input format error. I am not sure what to do next.
    Does anyone have any ideas please?
    Code:
     Dim Amount As Decimal = Session("BasketSum")
            Dim OrderID As String = Session("cartID")
            Dim CountNum As String = Session("BasketCount")
            Dim Redirect As String = "https://www.paypal.com/xclick/business=services@yumbo.com"
            Redirect += "&item_name=Shopping Cart Number " & OrderID
            Redirect += "&item_number=Number of Items " & CountNum
            Redirect += "&item_amount=" & String.Format("{0:c}", Amount)
            Redirect += "&return=http://www.yumbo.com"
            Redirect += "&cancel_return=http://www.yumbo.com"
            Response.Redirect(Redirect)

  2. #2
    Join Date
    Nov 2012
    Posts
    2

    Fix for PayPal input from your own shop cart in VB.NET

    Hi guys,
    For those who are interested, here's the fix for my problems above.
    Code:
        Protected Sub Checkout_Click(sender As Object, e As System.EventArgs) Handles Checkout.Click
    
            Dim OrderID As String = Session("cartID")
            Dim CountNum As String = Session("BasketCount")
    
            Dim Redirect As String = "https://www.paypal.com/xclick/business=services@yumbo.com"
            Redirect &= "&item_name=GayYumbo.com Order: " & OrderID
            Redirect &= "&item_number= " & CountNum
            Redirect &= "&amount= " & Double.Parse(Session("Basketsum")).ToString()
            Redirect &= "&return=http://www.yumbo.com"
            Redirect &= "&cancel_return=http://www.yumbo.com"
            Response.Redirect(Redirect)
    
        End Sub
    I hope this helps anyone with the same problem I had
    Regards all
    John

  3. #3
    Join Date
    Dec 2012
    Posts
    5
    Thanks for sharing!!!!

  4. #4
    Join Date
    Nov 2012
    Location
    America
    Posts
    5
    Thanks for sharing your solution.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles