Jump to content


Photo

PayPal Update


  • This topic is locked This topic is locked
2 replies to this topic

#1 denny1

denny1

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 21 August 2003 - 08:09 AM

As of the 8-14-03 update from PayPal my IPN code no longer works.
Can anyone see a problem with this template as to why it would work fine for several months then break?

I had the same problem when we updated to CFMX about a month and a half ago. I spent two days re-writing the code only to find out the original untouched code began to work again.

<!-- read post from paypal-->
<cfset str = "cmd=_notify-validate">
<cfloop index="TheField" list="#Form.FieldNames#">
<cfset str = str & "#LCase(TheField)#=#URLEncodedFormat(Evaluate(TheField))#">
<cfif TheField IS "payment_status" AND IsDefined("FORM.payment_date")>
<CFSET str = str & "&payment_date=#URLEncodedFormat(Form.payment_date)#">
</cfif>
</cfloop>
<!--post back to PayPal to validate-->
<CFHTTP URL="https://www.paypal.com/cgi-bin/webscr?#str#" METHOD ="GET" RESOLVEURL="false">
</CFHTTP>
<!--check notification validation-->
<CFIF CFHTTP.FileContent is "VERIFIED">
<CFIF FORM.payment_status eq "Completed">
<CFIF FORM.receiver_email eq "myemail@myemail.com">
<!--process payment-->
<cftry>
<cfquery name="qInsertCustomer" datasource="#DataSource#">
INSERT INTO Customers(payer_id, first_name, last_name, email)
VALUES ('#FORM.payer_id#', '#FORM.first_name#', '#FORM.last_name#', '#FORM.payer_email#')
</cfquery>
<cfcatch>
<!---log any errors when inserting customer--->
<cffile action="append" file="D:\Inetpub\wwwroot\www28\web\cart\paypal_log.txt" output="Error Inserting Customer">
</cfcatch>
</cftry>
<!--create 2 dimensional array to hold usernames and passwords--->
<cflock timeout="10" throwontimeout="no" type="exclusive" scope="session">
<cfset SESSION.aPasswordList= ArrayNew(2)>
</cflock>
<!--get raw data-->
<cfquery name="qPasswordList" datasource="#DataSource#">
SELECT CodeID, UserName, UserPassword
FROM codes
ORDER BY CodeID
</cfquery>
<!--loop thru array-->
<cflock timeout="10" throwontimeout="no" type="exclusive" scope="session">
<cfloop query="qPasswordList">
<cfset SESSION.aPasswordList[CurrentRow][1]=qPasswordList.UserName>
<cfset SESSION.aPasswordList[CurrentRow][2]=qPasswordList.UserPassword>
</cfloop>
</cflock>
<!--if first username and password are there then send email with download instructions and codes to customer-->
<cfif isDefined ("qPasswordList.UserName")AND isDefined("qPasswordList.UserPassword")>
<cftry>
<cfmail to="#FORM.payer_email#" from="info@tileandstonetips.com" subject="Your eBook Codes" type="html">
<html>
<head></head>
<body>
<!---here is where an html email is sent to the customer--->
</body>
</html>
</cfmail>
<!--send email to webmaster confirming order and the username and password assigned to that particular customer-->
<cfmail to="myemail@myemail.com" from="myotheremail@myemail.com" subject="A Sale At The Tile Site!">
Hello, Dennis
There has been a sale at Tile And Stone Tips!
The book has been purchased by #Form.first_name# #Form.last_name#
Their email address is: #Form.payer_email#
Their UserName is: #qPasswordList.UserName#
Their Password is: #qPasswordList.UserPassword#
</cfmail>
<cfcatch>
<!--log any errors sending these emails-->
<cffile action="append" file="D:\Inetpub\wwwroot\www28\web\cart\paypal_log.txt" output="#DateFormat(Now(), 'mm/dd/yyyy')# #TimeFormat(Now(),'HH:mm:ss')# Error sending email.">
</cfcatch>
</cftry>
<!--now delete the username and password from the database so that the same data is not sent to another customer-->
<cfset temp= ArrayDeleteAt(SESSION.aPasswordList,1)>
<cfquery name="Update" datasource="#DataSource#">
DELETE FROM codes
WHERE CodeID = #qPasswordList.CodeID#
</cfquery>
</cfif>
</CFIF>
</CFIF>
</CFIF>

FORM page:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="bn" value="wa_dw_2.0.4">
<input type="hidden" name="business" value="myemail@email.com">
<input type="hidden" name="item_name" value="Tile Layout">
<input type="hidden" name="item_number" value="001">
<input type="hidden" name="amount" value="19.00">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="return" value="http://www.tileandstonetips.com/thankYouOrder.html">
<input type="hidden" name="cancel_return" value="http://www.tileandstonetips.com/index.cfm">
<input type="hidden" name="undefined_quantity" value="0">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="rm" value="1">
<input type="hidden" name="notify_url" value="http://www.tileandstonetips.com/cart/ipn.cfm">
<input type="image" name="submit" src="http://images.paypal.com/images/x-click-but5.gif" border="0" alt="Make payments with PayPal, it's fast, free, and secure!">
</form>






#2 ron

ron

    Advanced Member

  • Members
  • 2,003 posts

Posted 21 August 2003 - 08:25 AM

Denny,

Go back up to the general IPN questions. PayPal installed a new release that seems to have broken IPN. They installed it last Friday morning.

Ron.

#3 Windwaker

Windwaker

    New Member

  • Members
  • 59 posts

Posted 21 August 2003 - 12:51 PM

Try adding a redirect="yes" into your CFHTTP tag.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users