|
Rank: Starting Member
Groups: Registered
Joined: 5/5/2004 Posts: 7 Location: ,
|
I am using eliteweaver's test and the test ipn form provided by PayPal_Paulam... everything with my ipn script for a subscription works fine with both testing environments. I even get an email using cfmail with the test info. When I change the ipn code to post to paypal...nothing happens. I get the return url after payment is made, the data is posting to the return url, but as far as the ipn is concerned nothing happens in the live test. Also, if I turn off autoreturn on paypal and make the return url in my buy form point to my script, the script performs as expected, but this requires the user to click continue. So I am trying to figure out...what's the purpose of IPN if it doesnt do anything until the user clicks continue, what if they dont click it? the database never gets updated. I will provide the code to all three pages.
Here is my buy page
========================
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input name="custom" type="text" id="custom">
<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but20.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<input type="hidden" name="business" value="tammy@tamtam.me.uk">
<input type="hidden" name="item_name" value="one month">
<input type="hidden" name="item_number" value="1mth">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="lc" value="GB">
<input type="hidden" name="a3" value="0.01">
<input type="hidden" name="p3" value="30">
<input type="hidden" name="t3" value="D">
<input type="hidden" name="src" value="1">
<input type="hidden" name="sra" value="1">
<input type="hidden" name="rm" value="1">
</form>
=================
Here is the IPN
=================
<cfset x = GetHttpRequestData()>
<CFSET str="cmd=_notify-validate&" & x.content>
<CFHTTP URL="https://www.paypal.com/cgi-bin/webscr?#str#" METHOD="GET" RESOLVEURL="false">
</CFHTTP>
<CFSET item_name=FORM.item_name>
<CFSET payment_status=FORM.payment_status>
<CFSET payment_amount=FORM.mc_gross>
<CFSET payment_currency=FORM.mc_currency>
<CFSET txn_id=FORM.txn_id>
<CFSET receiver_email=FORM.receiver_email>
<CFSET payer_email=FORM.payer_email>
<CFSET custom =FORM.custom>
<CFIF IsDefined("FORM.item_number")>
<CFSET item_number=FORM.item_number>
</CFIF>
<cfmail
to="admin@browngirls.co.uk"
from="info@browngirls.co.uk"
subject="Pay Pal Order ">
#FORM.first_name# #FORM.last_name#<br>
#FORM.address_street#<br>
#FORM.address_city#, #FORM.address_state# #FORM.address_zip#<p>
</cfmail>
===============
Here is the return
===============
<cfset
authToken="POmZ_kqHwNm1OA3FJkwGAIViaZaiAV16TAkntT0Keh-8QRFme0Rf-GHq6bu">
<cfset txToken = url.tx>
<cfset query="cmd=_notify-synch&tx=" & txToken &
"&at=" & authToken>
<CFHTTP url="https://www.paypal.com/cgi-bin/webscr?#query#"
method="GET"
resolveurl="false">
</CFHTTP>
<cfif left(#cfhttp.FileContent#,7) is "SUCCESS">
<cfloop list="#cfhttp.FileContent#"
index="curLine"
delimiters="#chr(10)#">
<cfif listGetAt(curLine,1,"=") is "first_name">
<cfset firstName=listGetAt(curLine,2,"=")>
</cfif>
<cfif listGetAt(curLine,1,"=") is "last_name">
<cfset lastName=listGetAt(curLine,2,"=")>
</cfif>
<cfif listGetAt(curLine,1,"=") is "item_name">
<cfset itemName=listGetAt(curLine,2,"=")>
</cfif>
<cfif listGetAt(curLine,1,"=") is "mc_gross">
<cfset mcGross=listGetAt(curLine,2,"=")>
</cfif>
<cfif listGetAt(curLine,1,"=") is "mc_currency">
<cfset mcCurrency=listGetAt(curLine,2,"=")>
</cfif>
</cfloop>
<cfoutput>
<p><h3>Your order has been received.</h3></p>
<b>Details</b><br>
<li>Name: #firstName# #lastName#</li>
<li>Description: #itemName#</li>
<li>Amount: #mcCurrency# #mcGross#</li>
<hr>
</cfoutput>
<cfelse>
ERROR
</cfif>
================
Also, aside from the test, is there any way to actaully see what paypal is posting to the ipn? I can see what is being posted to the return url, but if I disable the return url and stop at the ipn, the fields are empty.
Any ideas????? Anyone?????
|
|
Rank: Starting Member
Groups: Registered
Joined: 5/5/2004 Posts: 7 Location: ,
|
A follow up question.... Since all the variable I need are being passed to my return url, why couldnt I use that page to update or insert into my database? It seems the only difference is the "verified" or "invalid" response. But if I get completed, pending, denied, etc why couldnt I just use those as conditions of the action upon the return page? Someone help please...Going into week 2 with trying to implement paypal for my client and I am getting frstrated. Nothiing posts to my ipn. Its seems no one has the answer, or at least I cant find it.
|
|
Rank: Starting Member
Groups: Registered
Joined: 5/3/2004 Posts: 7 Location: ,
|
I just had the same issue. In theory, if you set up your IPN url in your account. Your IPN should be hit when user make a payment. But it's not work for me neither. After a few days' reading, I figure out you can put a "notify_url" hidden field with your IPN url in your "PayNow" button. In the test, the IPN page was hit successfully. Hope this will help you a bit
|