Paypal Mod

Post here to discuss topics relate to the 4.x version for the ASP Football Pool software program. All support topics should go here.
Post Reply
hedpe_23
Posts: 7
Joined: Mon Oct 06, 2014 5:44 am

Paypal Mod

Post by hedpe_23 »

Has anyone gotten the paypal mod to work. I have tried everything and am still getting nowhere.

Mike
hedpe_23
Posts: 7
Joined: Mon Oct 06, 2014 5:44 am

Re: Paypal Mod

Post by hedpe_23 »

I have it working now in a sql version.
kingmullet
Posts: 59
Joined: Thu Sep 05, 2013 3:21 pm

Re: Paypal Mod

Post by kingmullet »

How did you get this to work. I have had no luck
HZass
Posts: 19
Joined: Mon Sep 02, 2013 9:54 am

Re: Paypal Mod

Post by HZass »

Mike,
Do you have the code for SQL version of PayPal? I sure could use a copy. Thanks
jhronesz
Posts: 43
Joined: Sat Aug 31, 2013 4:20 pm

Re: Paypal Mod

Post by jhronesz »

I have it working in the access version.
hedpe_23
Posts: 7
Joined: Mon Oct 06, 2014 5:44 am

Re: Paypal Mod

Post by hedpe_23 »

Did you set up the IPN settings in your paypal account?
hedpe_23
Posts: 7
Joined: Mon Oct 06, 2014 5:44 am

Re: Paypal Mod

Post by hedpe_23 »

My code for the paymentnotify.asp page.
You need to make sure you have the ipn settings set up to direct to this page on your server.
My header and connection files are most likely different than yours.


<%@ LANGUAGE="VBScript" %>
<!-- #include file="connection/connection.asp" -->
<!-- #include file="header2014.asp" -->

<!-- #include file="includes/encryption.asp" -->
<!-- #include file="includes/payments.asp" -->
<% 'Get the posted data and append the validate command parameter.
dim postData
postData = Request.Form & "&cmd=_notify-validate"

'Validate the notification.
dim xmlHttp, validateResponse
set xmlHttp = Server.CreateObject("Microsoft.XMLHTTP")
xmlHttp.open "POST", PAYPAL_VERIFY_URL, false
xmlHttp.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
xmlHttp.Send(postData)
validateResponse = xmlHttp.responseText

'Open the database.
call OpenDb()

'Log the notification data.
dim sql
dim data
data = Encrypt(Request.Form)
sql = "INSERT INTO PaymentNotifications" _
& " ([Timestamp], Data, Response)" _
& " VALUES('" & GetCurrentDateTime() & "'," _
& " '" & data & "'," _
& " '" & validateResponse & "')"
call DbConn.Execute(sql)

'If valid, process the data.
dim txn, invoice, payment, handling, username, description, amount
if validateResponse = "VERIFIED" then

'For completed payments and refunds, update the user's account.
if Request.Form("payment_status") = "Completed" or _
Request.Form("payment_status") = "Refunded" then

'Get the payment data.
txn = Request.Form("txn_id")
invoice = Request.Form("invoice")
payment = Request.Form("payment_gross")
handling = Request.Form("handling_amount")
username = Request.Form("custom")

description = "Payment"
if Request.Form("payment_status") = "Refunded" then
description = "Refund"
handling = -handling
end if
description = description & " (PayPal: INV# " & invoice & ", TXN# " & txn & ")"
amount = Round(payment - handling, 2)


'Create and insert the payment record.
sql = "INSERT INTO Credits" _
& " (Username, [Timestamp], Description, Amount)" _
& " VALUES('" & Sqlstring(username) & "'," _
& " '" & GetCurrentDateTime() & "'," _
& " '" & Sqlstring(description) & "'," _
& " " & amount & ")"
call DbConn.Execute(sql)

end if
end if %>



Also, on the makepayment.asp page, I think you need to have these lines set up this way.

<form id="paypalForm" action="<% = PAYPAL_PAYMENT_URL %>" method="post">
<div>
<input type="hidden" name="amount" value="" />
<input type="hidden" name="business" value="<% = PAYPAL_BUSINESS %>" />
<input type="hidden" name="cancel_return" value="yoursitename/Paymentcanceled.asp" />
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="custom" value="<% = Session(SESSION_USERNAME_KEY) %>" />
<input type="hidden" name="handling" value="" />
<input type="hidden" name="invoice" value="" />
<input type="hidden" name="item_name" value="<% = PAYPAL_ITEM_NAME %>" />
<input type="hidden" name="no_shipping" value="1" />
<input type="hidden" name="notify_url" value="yoursitename/paymentNotify.asp">
<input type="hidden" name="return" value="yoursitename/paymentComplete.asp" />
<input type="hidden" name="rm" value="2" />
<input type="hidden" name="tax" value="0" />
</div>
</form>
hedpe_23
Posts: 7
Joined: Mon Oct 06, 2014 5:44 am

Re: Paypal Mod

Post by hedpe_23 »

The IPN settings set up in my selling tools in Paypal, sorry.
Post Reply