Jump to content


Photo

Does Coldfusion really work with IPN?


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

#1 rickaclark

rickaclark

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 22 December 2005 - 03:15 PM

I have read manuals 'til I am blue in the face. I have tried every way I can to have Paypal send my variables back to my site, only to have an error message telling me the data forms do not exist.

I searched several forums and the overriding sentiment is people can't get coldfusion to work with IPN.

I am using the Coldfusion SDK files, but they aren't working. I am trying to get my data from Paypal and insert it into an access database for tracking purposes.

Anybody have any advice or suggestions?



#2 ziggyziggy

ziggyziggy

    Member

  • Members
  • PipPip
  • 15 posts

Posted 22 December 2005 - 09:10 PM

if you mean form variables are missing there is another format to avoid a bug. see the post about working code.

Then again, I just get back INVALID because not exactly whatwas posted to me it seems, but no idea why.

#3 rickaclark

rickaclark

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 23 December 2005 - 10:14 AM

I tired using the scripts from the following post:
http://www.paypaldev...dfusion,and,IPN

I used the following ipn script:
<CFSET str="cmd=_notify-validate">
<CFLOOP INDEX="TheField" list="#Form.FieldNames#">
<CFSET str = str & "#LCase(TheField)#=#URLEncodedFormat(Evaluate(TheField))#">
</CFLOOP>
<CFIF IsDefined("FORM.payment_date")>
<CFSET str = str & "&payment_date=#URLEncodedFormat(Form.payment_date)#">
</CFIF>
<CFIF IsDefined("FORM.subscr_date")>
<CFSET str = str & "&subscr_date=#URLEncodedFormat(Form.subscr_date)#">
</CFIF>

<!-- post back to PayPal system to validate -->
<CFHTTP URL="https://www.paypal.com/cgi-bin/webscr?#str#" METHOD="GET" RESOLVEURL="false">
</CFHTTP>

<!-- assign posted variables to local variables -->
<CFSET receiver_email=FORM.receiver_email>


<!-- note: additional IPN variables also available -- see IPN documentation

<CFSET item_name=FORM.item_name>
<CFSET payment_status=FORM.payment_status>
<CFSET payment_gross=FORM.payment_gross>
<CFSET txn_id=FORM.txn_id>
<CFSET payer_email=FORM.payer_email>
<CFIF IsDefined("FORM.item_number")>
<CFSET item_number=FORM.item_number>
</CFIF>

-->

<!-- check notification validation -->
<CFIF #CFHTTP.FileContent# is "VERIFIED">

<cfoutput>
Email: #FORM.receiver_email#<br />
Name: #form.first_name# #form.last_name#<br />
Payment Status: #form.payment_status#<br />
It works!
</cfoutput>

<!-- check that payment_status=Completed -->
<!-- check that txn_id has not been previously processed -->
<!-- check that receiver_email is your email address -->
<!-- process payment -->

<CFELSEIF #CFHTTP.FileContent# is "INVALID">
<!-- log for investigation -->

It's not being verified!

<CFELSE>
<!-- error -->
</CFIF>
<!--- end script --->

I used the following form, suggested by paypa_pb, to test the ipn script and it worked fine:

<form method="post" action="http://www.heartlandcommunitychurch.com/cart/ipn_new.cfm">
<input type="submit" name="" value="Test IPN">
<input type="hidden" name="payment_date" value="17:53:45 Nov 5, 2002 PST">
<input type="hidden" name="txn_type" value="web_accept">
<input type="hidden" name="last_name" value="Breitenbach">
<input type="hidden" name="item_name" value="">
<input type="hidden" name="payment_gross" value="0.01">
<input type="hidden" name="mc_currency" value="USD">
<input type="hidden" name="payment_type" value="instant">
<input type="hidden" name="verify_sign" value="AlWncXKLadIepzMosHhM.VWxC0Z6AZYI0ynXRnEUma0d3RMC.TXWaJro">
<input type="hidden" name="payer_status" value="unverified">
<input type="hidden" name="payer_email" value="pb-test@paypal.com">
<input type="hidden" name="txn_id" value="01G32341KC3727119">
<input type="hidden" name="first_name" value="Patrick">
<input type="hidden" name="quantity" value="1">
<input type="hidden" name="receiver_email" value="pb-sell@paypal.com">
<input type="hidden" name="payer_id" value="QGVDAFGZ9XHLJ">
<input type="hidden" name="payment_method" value="non_cc">
<input type="hidden" name="item_number" value="">
<input type="hidden" name="payment_status" value="Completed">
<input type="hidden" name="mc_gross" value="0.01">
<input type="hidden" name="custom" value="">
<input type="hidden" name="notify_version" value="1.4">
</form>
<!--- end script --->

But when I changed the ipn script to run in snadbox with:
<!-- post back to PayPal system to validate -->
<CFHTTP URL="https://www.sandbox.paypal.com/cgi-bin/webscr?#str#" METHOD="GET" RESOLVEURL="false">
</CFHTTP>

and used the following form:
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="rick@rickclark.com">
<input type="hidden" name="item_name" value="golf shirt">
<input type="hidden" name="item_number" value="hwc1001">
<input type="hidden" name="amount" value="25.00">
<input type="hidden" name="return" value="http://heartlandcommunitychurch.com/cart/ipn_new.cfm">
<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.sandbox.paypal.com/en_US/i/btn/x-click-but23.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</form>

I get the following error:
Element FIELDNAMES is undefined in FORM.

This is what brings me to wonder if I really want to delve into paypal and coldfusion. Any suggestions?


#4 ziggyziggy

ziggyziggy

    Member

  • Members
  • PipPip
  • 15 posts

Posted 25 December 2005 - 01:56 AM

Yes, do what I said: "there is another format to avoid a bug. see the post about working code."




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users