PayPal Donation using CCK

Several postings have asked for a fast way to take a donation from a user and process it via PayPal. The E-Commerce module has a facility to do this, but it involves a shopping cart and several additional steps for the user, thus driving down the likelihood of completing the donation process.

This example features a custom CCK donation form that dynamically generates the PayPal button once the donation parameters are submitted. The user then simply clicks the button and is off to PayPal to pay for the donation. It is assumed that the reader is familiar with the PayPal developer's requirements to process payments. If not, please go to http://developer.paypal.com. It is also assumed that the reader is familiar with CCK and computed fields. This example does provide some instruction on implementing html via php inside of a computed field. I do not profess to be proficient or professional at coding either html or php, so please accept my code with a grain of salt. It does work for me.

I have not been able to get PayPal's dynamic encryption working yet with this and will return to this post if I ever get it up and running.

Building the CCK Node:

The following fields are defined in this CCK node:

Note: all computed fields are stored.

Donation Date
field_donation_date
Datestamp

Organization
This is a hardcoded code for the organization to which the donation is to be made. This is optional in most installations, but necessary in this instance as we service multiple organizations.
field_organization
Computed field$node_field[0]['value'] = "WFF";

Tax Status
In this instance, the user can choose between making a tax deductible contribution to our 501(c)(3) side of the house or a non-deductible donation to our political action wing.
field_tax_status
Text - Check Boxes/Radio Buttons

Donation Frequency
User can select a one time donation or a recurring donation. Note that PayPal has different calls depending on whether the payment is a one time payment or recurring (subscription) payment. It is all factored into this process.
field_donation_frequency
Text - Check Boxes/Radio Buttons

This is a great functionality due to its simplicity (if a lot of the code is paired down). Really, really would love to see a way for the viewer of the node, not the creator, to select the amount to be donated.

When you add the field, select Text - Decimal, instead of Text - Select. After saving the field setting, you may need to Edit the field to fill in the Decimal places (2) and some other settings; such as Default: 1.00. This allows the Viewer to fill in the text box with the amount they want to donate.