quote:
As I understand it PayPal's IPN now requires a POST rather
than a GET
All of my code that I use with IPN is GET, and it is used
many times during the day.
On my IPN, which is setup mainly for ReOccuring Payments, I
use this CODE:
<cftry>
<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>
<!---Set vars from returned data--->
<CFIF #CFHTTP.FileContent# is "VERIFIED">
<cfset txn_type = '#FORM.txn_type#'>
<CFIF IsDefined("FORM.item_number")>
<cfset Username = '#form.item_number#'>
</cfif>
<CFIF IsDefined("url.username")>
<cfset Username = '#url.username#'>
</cfif>
<cfset payer_id = '#form.payer_id#'>
<cfset subscr_id = '#form.subscr_id#'>
<cfset first_name = '#form.first_name#'>
<cfset last_name = '#form.last_name#'>
<cfset payer_email = '#FORM.payer_email#'>
<CFIF IsDefined("FORM.subscr_date")>
<cfset subscr_date = '#form.subscr_date#'>
</cfif>
<CFIF IsDefined("FORM.payment_date")>
<cfset payment_date = '#form.payment_date#'>
</cfif>
<CFIF IsDefined("FORM.payment_gross")>
<cfset payment_gross = '#form.payment_gross#'>
</cfif>
<CFIF IsDefined("FORM.payment_status")>
<cfset payment_status = '#form.payment_status#'>
</cfif>
<CFIF IsDefined("FORM.txn_id")>
<cfset txn_id = '#form.txn_id#'>
</cfif>
</CFIF>
<!---If this is a subscription setup--->
<cfif #FORM.txn_type# is "subscr_signup">
<!---update orders table--->
cfquery name="InsertOrder" datasource="#mydatasource#">
INSERT INTO Orders(user_name, payment_status, payment_date,
payment_gross, txn_id, txn_type, payer_email, subscr_date,
subscr_id, payer_id)
VALUES('#Username#', 'SubSetup',
'#DateFormat(now(),'mm/dd/yy')#', '0', '', '#TXN_TYPE#',
'#payer_email#', '#DateFormat(now(),'mm/dd/yy')#','#subscr_id#',
'#payer_id#')
</cfquery>
<cfcatch type="any">
<cffile action="append"
file="d:\inetpub\website\paypal_errorlog.txt"
output="#DateFormat(Now(),'mm/dd/yy')#: Error on Paypal IPN
page:
#cfcatch#">
<br />
</cfcatch>
</cftry>
Now I also do quite a bit of other things as well in my code,
update tables and send emails, and the query here is for example .
But this works fine all of the time.
What error are you getting exactly?Well I take it all back Michael and I must apologise you're
right. That what comes of RTFM!
The PaylPal doc's do say "Here are the guidelines for
constructing the IPN HTTPS POST to PayPal for notification
validation." and "Your POST must be sent to
https://www.paypal.com/cgi-bin/webscr" hence my hang up about
cfhttp method="post" rather than get. My confusion was compound by
using a PayPal IPN tester that they suggested
http://paypaltech.com/Stephen/test/ipntest.htm.
It is good but I was assuming that it need posting, no sorry
getting, back to the the sandbox server but that doesn't work, you
need to submit your response to the live server.
I've slightly tidied up the code to suit my style and it does
work against the sandbox server and if you point it to the live
server the "Stephen Test" will work.
Once again my apologise in doubting you Michael :-)
dickbob