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)
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