Paypal and File Library - Posted (925 Views)
Advanced Member
JJenson
Posts: 2121
2121
Ok I have been researching this and I am not sure how I can do this. What I am looking for is if someone could tell me if this is possible what I am trying to do.
I have a paid section now in this section I need a button that will generate and send them to the correct product on paypal. now I have the code to connect to certain products on the site. This is the HTML paypal says to use to connect to their item.
Code:

<form action="web address" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="email.com">
<input type="hidden" name="buyer_credit_promo_code" value="">
<input type="hidden" name="buyer_credit_product_category" value="">
<input type="hidden" name="buyer_credit_shipping_method" value="">
<input type="hidden" name="buyer_credit_user_address_change" value="">
<input type="hidden" name="no_shipping" value="0">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="bn" value="PP-BuyNowBF">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

NOw I need to know if anyone could tell me the logic for a way to generate a buy now on the files in the library that will direct them to the correct paypal target.

Then I am supposed to be able to pass values in those param that will let me send the proper information back so if successful then they can download the file.

My problem is I am not uploading all the files I am letting certain people upload their own plugins. I am not sure how to get correct buy now buttons in their for them to be able to purchase the product?
I hope this makes sense what I am trying to do I am just lost in my thinking of how to do this any ideas?<
 Sort direction, for dates DESC means newest first  
 Page size 
Posted
Support Moderator
Shaggy
Posts: 6780
6780
If you add the item_number field to your form, you could use it to pass the ID of the file through to PayPal, assuming all the files have a corresponding entry in the database.
<
Search is your friend “I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Posted
Advanced Member
JJenson
Posts: 2121
2121
Hmm I will check and see if the file library has an id associate with each file. I am guessing it would have to. Then on the return use the id to associate with the link and have it redirect them to the link from the success page.
Now I guess if I am having the id pass in the button all I would need to include is something like this on the id name:

<input type="hidden" name="item_id" value="<% =ID %>">

I am guessing this is how I would pass that value across?
There is an ID associated with each file but curiosity how does it know which table to pull the id from or is my code above not enough code to show that?
Thanks for the idea

<
Posted
Advanced Member
JJenson
Posts: 2121
2121
Ok I have been playing with this and I have a couple questions if someone can help me out. This is my first attempt ever at trying to actually write code from scratch and I keep running into issues go figure.
Now this is the page I have for the return page after paying at paypal this is where they get sent.
Code:

'sub DownloadTheFile
' strSql = "SELECT *"
' strSql = strSql & " FROM " & strTablePrefix & "FILEMANAGER "
' strSql = strSql & "WHERE ID = " & thisID
' Set rs = my_Conn.Execute (strSql)

' intID = rs("ID")
' intDate = rs("F_DATE")
' fileFileLink = rs("F_FILELINK")

' rs.Close

'if (objHttp.responseText = "INVALID") then
Response.Write " <table border=""0"" width=""100%"" cellspacing=""0"" cellpadding=""0"">" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td bgcolor=""" & strHeadCellColor & """ background=""" & strImageURL & strHeadCellBGImage & """ width=""100%"" height=""25"" align=""center""><b><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strHeadFontColor & """>" & vbNewLine & _
" Payment Details" & vbNewLine & _
" </td></tr>"
Response.Write " <tr>" & vbNewLine & _
" <td bgcolor=""#FFFFFF"" width=""100%"" align=""center""><p>" & vbNewLine & _
" Your transaction did not go through" & vbNewLine & _
" </p></td></tr></table>" & vbNewLine
'else if (objHttp.responseText = "VERIFIED") then
Response.Write " <table border=""0"" width=""100%"" cellspacing=""0"" cellpadding=""0"">" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td bgcolor=""" & strHeadCellColor & """ background=""" & strImageURL & strHeadCellBGImage & """ width=""100%"" height=""25"" align=""center""><b><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strHeadFontColor & """>" & vbNewLine & _
" Payment Details" & vbNewLine & _
" </td></tr>"
Response.Write " <tr>" & vbNewLine & _
" <td bgcolor=""#FFFFFF"" width=""100%"" align=""center""><p>" & vbNewLine & _
" Thank you for your purchase <br /><br /><a href=""file_library.asp?showmethefile=" & intID & "&FileName=" & fileFileLink & "&FileDate=" & intDate & "&download=1"" target=""_blank""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strForumLinkColor & """>Click Here TO Download Your File</font></a>" & vbNewLine & _
" </p></td></tr></table>" & vbNewLine

Now I am not sure the code that comes back across is called item_number.
I am not sure how I get the item number to call the ID number of the file then
to have that add in the proper link url.
I was thinking a strSql statement but not sure how I can make that make the proper
url to show up?
Thanks all smile<
Posted
Advanced Member
JJenson
Posts: 2121
2121
Ok researching and working through this I just need to know if I am allowed to do something like the following statement.
' strSql = "SELECT *"
' strSql = strSql & " FROM " & strTablePrefix & "FILEMANAGER "
' strSql = strSql & "WHERE ID = " & intID
' Set rs = my_Conn.Execute (strSql)

' intID = rs("ID")
' intDate = rs("F_DATE")
' fileFileLink = rs("F_FILELINK")

' Request.Form("item_number") = intID
I basically need the item_number to be the same as the intID so that it will pull the proper data from the DB<
Posted
Advanced Member
JJenson
Posts: 2121
2121
Ok nevermind I got it. All is working now :) at least for my test pages now to get the values passing through paypal smile<
 
You Must enter a message