Gentlemen (and Ladies), I have a shopping cart in a datagrid. I have totalled up how much the guest needs to pay and put that into a an ASP:Label, it is also in session("Amount"). How do I transfer this decimal variable amount into an HTML hidden input
field for PayPal? I only want to transfer the total amount, I do not need every item in their shopping cart. Thank you in advance
Well, I now can transfer the CartID from the database and the count of items in the shopping basket. Can I get the amount across, not on your life! I enclose the code I am using, could anyone please tell me if I have the syntax down wrongly. I have
tried taking the item_ out of the amount statement but PayPal returns a faulty input file error message.
Thank you for any ideas you might have.
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 += "&cancel_return=http://www.yumbo.com"
Response.Redirect(Redirect)
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
All I need to do now is to add the line for currency code as I want it in Euros
Any suggestions, mine are prooving fatal!
Thank you for your help in getting the amount across. Very much appreciated.
bikercaz
Member
16 Points
19 Posts
shop cart total put into asp:label needs tranferring into html hidden field for PayPal
Nov 17, 2012 01:59 PM|LINK
Gentlemen (and Ladies), I have a shopping cart in a datagrid. I have totalled up how much the guest needs to pay and put that into a an ASP:Label, it is also in session("Amount"). How do I transfer this decimal variable amount into an HTML hidden input field for PayPal? I only want to transfer the total amount, I do not need every item in their shopping cart. Thank you in advance
ramiramilu
All-Star
97799 Points
14494 Posts
Re: shop cart total put into asp:label needs tranferring into html hidden field for PayPal
Nov 17, 2012 03:49 PM|LINK
put a asp.net HiddenField control on the page, and then in the codebehind you can assign it like this - HiddenField1.Value = Session["values"];
or else you can do the same with Html Hidden Field but with runat="server" attribute....
also if you want to access server variables from client then - http://www.intstrings.com/ramivemula/articles/access-code-behind-variables-in-aspx-and-javascript/
thnaks,
JumpStart
bikercaz
Member
16 Points
19 Posts
Re: shop cart total put into asp:label needs tranferring into html hidden field for PayPal
Nov 17, 2012 05:02 PM|LINK
Thank you, I will try that in the morning. I appreciate your help
bikercaz
Member
16 Points
19 Posts
Re: shop cart total put into asp:label needs tranferring into html hidden field for PayPal
Nov 17, 2012 11:52 PM|LINK
Well, I now can transfer the CartID from the database and the count of items in the shopping basket. Can I get the amount across, not on your life! I enclose the code I am using, could anyone please tell me if I have the syntax down wrongly. I have tried taking the item_ out of the amount statement but PayPal returns a faulty input file error message.
Thank you for any ideas you might have.
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 += "&cancel_return=http://www.yumbo.com" Response.Redirect(Redirect)bikercaz
Member
16 Points
19 Posts
Re: shop cart total put into asp:label needs tranferring into html hidden field for PayPal
Nov 27, 2012 03:13 PM|LINK
The VB code that works is as follows:
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 SubAll I need to do now is to add the line for currency code as I want it in Euros
Any suggestions, mine are prooving fatal!
Thank you for your help in getting the amount across. Very much appreciated.