Skip to main content
Inspiring
April 12, 2010
Question

Complex Object error with IPN PayPal

  • April 12, 2010
  • 2 replies
  • 1013 views

I'm at my wits end.  I know it's got to be obvious, but I can't find it.  I am getting the error, "Complex object types cannot be converted to simple values." when my PayPal IPN returns the validation.  I get this with the first line of code where I try to get the variables and their values.  I don't see any reserved words being used in the string.

The weird thing?  This code has worked fine for the last 3 years.  I have no idea what could have changed.  I can't think of anything that would have effected this.  The error is from the line below that is in red.

Can anyone suggest a way that I can test this line-by-line?  I'm receiving the error report, but it doesn't really say more than the error above.  It does show all the variables and their values, but I just don't see anything wrong in it.

<CFSET str="cmd=_notify-validate">

<cfparam name="TEMPSTR" default="">

<CFIF IsDefined("FORM.fieldnames")>
<CFLOOP INDEX="TheField" list="#Form.FieldNames#">
    <CFSET tempstr = variables.tempstr & "&#LCase(TheField)#=#URLEncodedFormat(Evaluate(TheField))#">
</CFLOOP>
</CFIF>
<CFIF IsDefined("FORM.payment_date")>
    <CFSET tempstr = variables.tempstr & "&payment_date=#URLEncodedFormat(Form.payment_date)#">
</CFIF>
<CFIF IsDefined("FORM.subscr_date")>
    <CFSET tempstr = variables.tempstr & "&subscr_date=#URLEncodedFormat(Form.subscr_date)#">
</CFIF>

Below are the formfields and values from PayPal to the IPN.cfm page that is hanging in the form.fieldnames loop.  All the values have been changed to bogus values, but they are the same format.

mc_gross=4.00&

protection_eligibility=Eligible&

address_status=confirmed&

payer_id=A123BCDEFGH123&

tax=0.00&

address_street=123 Sesame Street&

payment_date=16:37:05 Apr 11, 2010 PDT&

payment_status=Completed&

charset=windows-1252&

address_zip=12345-6789&

first_name=Jane&

mc_fee=0.32&

address_country_code=US&

address_name=Jane Doe&

notify_version=2.9&

custom=123456789&

payer_status=verified&

business=test@aol.com&

address_country=United States&

address_city=Orlando&

quantity=1&

verify_sign=ABcdeFgHIJk13j.n-uTG&

payer_email=test2@aol.com&

txn_id=ZXWYRT123&

payment_type=instant&

last_name=Doe&

address_state=FL&

receiver_email=test@aol.com&

payment_fee=0.32&

receiver_id=KLJIOUY789&

txn_type=web_accept&

item_name=tshirt&

mc_currency=USD&

item_number=456&

residence_country=US&

handling_amount=0.00&

transaction_subject=789&

payment_gross=1.00&

shipping=0.00

    This topic has been closed for replies.

    2 replies

    Inspiring
    April 12, 2010

    This problem has been resolved. I hope it helps others.

    Inspiring
    April 12, 2010

    Thanks for posting the resolution. From what I recall, their samples are a bit outdated, and not the greatest in terms of best practices. You might also want to do a quick search on IPN + Paypal + ColdFusion. There are some more recent blog entries you might find useful, like:

    http://www.dougboude.com/blog/1/2009/11/PayPal-IPN-Coldfusion-CFC.cfm

    Inspiring
    April 12, 2010

    Thank you for the link.  I had written that so many years ago, it was probably what was out there at the time.  That's what threw me.  It just

    "broke" one day without anyone touching anything.  My hope was to spend a little time patching it and not starting over, but it took longer than I had planned.

    As a ColdFusion developer for the last 10 years, it's frustrating that so much is catered to php and asp.  I'll want to find a simple module that is common and shouldn't have to be reinvented and only find it in php and asp.  If I didn't have so much invested in CF, I'd be tempted to jump ship.  I really don't want to, but CF is not supported like the others.  Having vented, I do have to say that I've created some very cool, powerful apps with CF (online testing, conference setups from start to finish, etc.).  I was actually surprised to see that PayPal even had sample code for CF.

    I really appreciate your response.  It's nice to know that there are other CF developers still out there.

    Inspiring
    April 12, 2010

    "Custom" is the name of  a variable sent by PayPal.  It is the reserved word that was hanging the code.

    Inspiring
    April 12, 2010

    I hope this helps someone else.  The ColdFusion IPN code is all over the internet with the line that I used.  If it's going to work with PayPal's new variable "custom" then you have to remove "evaluate" from the following line:

    WAS:

    <CFSET tempstr = variables.tempstr & "&#LCase(TheField)#=#URLEncodedFormat(Evaluate(TheField))#">

    TO:

    <CFSET tempstr = variables.tempstr & "&#LCase(TheField)#=#URLEncodedFormat(TheField)#">