Jump to content


Help with ColdFusion IPN.

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

#1 splendorx



  • Members
  • Pip
  • 2 posts

Posted 05 November 2002 - 03:56 PM

I have tested the CF ipn script from Pay Pal, but I seem to have a problem verifying it.

Here is the code:

<!-- read post from PayPal system and add 'cmd' -->
<CFSET str="cmd=_notify-validate">
<CFLOOP INDEX="TheField" list="#Form.FieldNames#">
<CFSET str = str & "&#LCase(TheField)#=#URLEncodedFormat(Evaluate(TheField))#">
<CFIF IsDefined("FORM.payment_date")>
<CFSET str = str & "&payment_date=#URLEncodedFormat(Form.payment_date)#">
<CFIF IsDefined("FORM.subscr_date")>
<CFSET str = str & "&subscr_date=#URLEncodedFormat(Form.subscr_date)#">

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

<!-- 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>


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


It works!

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

<!-- log for investigation -->

It's not being verified!

<!-- error -->

I am using a third-party to verify:


I am trying to pass the value of receiver_email to verify transaction is working properly. No luck. Not sure what I may be doing incorrectly. I would appreciate any feedback.

  • Mymnrumourf, xxkalliy, Infevavof and 1 other like this

#2 paypal_pb


    Advanced Member

  • Members
  • 2,960 posts

Posted 05 November 2002 - 06:57 PM

Set the "action" to the URL of your CFM script and copy/paste this code into a blank web page. This simulates an IPN. Since this is a real transaction, you should get a "VERIFIED" response from the PayPal server.

<form method="post" action="http://www.mysite.com/ipn.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">

Patrick Breitenbach
PayPal, Inc.
Dev Net: https://www.paypal.com/pdn

#3 paypal_pb


    Advanced Member

  • Members
  • 2,960 posts

Posted 06 November 2002 - 12:14 PM

Yes, any modification to those form variables will cause it not to validate.

If your script works with this POST, then you should be able to successfully process IPNs on the live system.

Patrick Breitenbach
PayPal, Inc.
Dev Net: https://www.paypal.com/pdn

#4 paypal_pb


    Advanced Member

  • Members
  • 2,960 posts

Posted 06 November 2002 - 05:55 PM

You might try modifying:
<CFHTTP URL="https://www.paypal.com/cgi-bin/webscr?#str#" METHOD="GET" RESOLVEURL="false">

by changing the 'https' to 'http'.

It's possible your ColdFusion server may not be able to perform https.

Patrick Breitenbach
PayPal, Inc.
Dev Net: https://www.paypal.com/pdn

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users