A DotNetNuke i'm supporting has had a paypal "buy now" button and other variations with custom fields for a while now. About 2 weeks ago (somewhere in March 2010) they all stopped working. The problem manifested such that once you clicked the "buy now" button, Paypal site would throw a scary
error page to the effect of: "Internal Server
Error The server encountered an internal
error or misconfiguration and was unable to complete your request. Please contact the server administrator,
[email protected] and inform them of the time the
error occurred, and anything you might have done that may have caused the
error. More information about this
error may be available in the server
error log" Once I verified no cheeky content editor changed the page, I went digging for answers. The main source incompatibility of PayPal's simple HTML forms is that DNN includes a form on every page, and nested forms are not really supported. As blogged here and lamented here, the solution I came up with is simply to modify the form enctype to 'application/x-www-form-urlencoded' as illustrated below: 1: <input type="image" border="0"
2: src="https://www.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif"
3: name="submit"
4: alt="PayPal - The safer, easier way to pay online!"
5: onClick="this.form.action='https://www.paypal.com/cgi-bin/webscr'; this.form.enctype='application/x-www-form-urlencoded';this.form.submit();" />
One would think that PayPal would want the masses submitting HTML in all manners of "enctype", but I guess every company has it's quirks.
At least my favorite non-profit can now continue and accept payments.
Sigh.