This plugin hasn’t been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.

This plugin has been closed and is no longer available for download.

Simple PayPal Donate

Description

As well as making it easier to control your output, this plugin assists with multiple occurrences across a WordPress installation (maintaining a single point for the code, particularly useful if the code changes in future). It is also XHTML compliant, unlike the original PayPal code.

Step 1: Create your button

If you’ve not done so already, create your donation button…

  1. Log into your PayPal account
  2. The option to take donations can be found under “Merchant Services”
  3. Create the button, as required, and you will be shown some code to add to your website
  4. Within this code is a button_id (or equivalent encrypted value) and image URL – you will need these for the Simple PayPal Donate plugin to work

Here is an example of the code produced for the donation button on the artiss site…

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="2851382">
<input type="image" src="https://www.paypal.com/en_GB/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="">
<img alt="" border="0" src="https://www.paypal.com/en_GB/i/scr/pixel.gif" width="1" height="1">
</form>

The button ID, if present, is the 7 digit numeric value usually at the end of the third line of code (e.g. ‘2851382’). If this is not present you may have an encryped value instead (this has a value containing a long string of characters, with -BEGIN near the start of the value). Either one of these can be used in this plugin.

The image URL is the “src” usually on the 4th line (e.g. ‘https://www.paypal.com/en_GB/i/btn/btn_donateCC_LG.gif’).

Step 2: Create the code

To display your PayPal Button on your WordPress site you will need to insert the following code, where appropriate, into your theme…

<?php simple_paypal_donate('9999999','https://www.paypal.com/en_GB/i/btn/btn_donateCC_LG.gif'); ?>

You will need to replace some of the above details with those that I suggested you note before, as supplied by PayPal. The first parameter is your button ID or encrypted value (either will work) and the second parameter is the image URL.

If you wish to ensure that your code still works correctly, even if Simple PayPal Donate is switched off, you can use the following format of code…

<?php if (function_exists('simple_paypal_donate')) simple_paypal_donate('2851382','https://www.paypal.com/en_GB/i/btn/btn_donateCC_LG.gif'); ?>

Alternatively, since version 1.2 you can specify the button ID using the parameter id=. When using this method you can use additional sub-parameters. These are…

target= : specify a link TARGET (default is no TARGET is specified).

alt= : change the default image ALT text. This can’t include an ampersand, otherwise it will be interpreted as an additional sub-parameter.

When using multiple sub-parameters, they must be separated with an ampersand.

For example…

<?php simple_paypal_donate('id=2851382&target=_self&alt=Donate!','https://www.paypal.com/en_GB/i/btn/btn_donateCC_LG.gif'); ?>

As the first parameter we have specified thre sub-parameters – the button ID, the link TARGET and the ALT text.

Using the shortcode

Alternatively, if you wish to add a PayPal donation button directly into a specific page or post then you can use a WordPress shortcode.

Simply type [paypal] wherever you wish the button to appear, but with the following options…

id : the button ID or encrypted value (required)

image : the image URL (required)

target : link target (optional)

alt : ALT image text (optional)

For example…

[paypal id=9999999 image="https://www.paypal.com/en_GB/i/btn/btn_donateCC_LG.gif"]

Returning a link

If you wish to not generate button, but simply need a link to the PayPal donation page, then a simple function call is available that will return the appropriate URL – paypal_link. To use, simply supply the button ID (the encrypted value does not work in this situation).

For example….

<a href="<?php echo paypal_link('9999999'); ?>">Please donate</a>

For help with this plugin, or simply to comment or get in touch, please read the appropriate section in “Other Notes” for details. This plugin, and all support, is supplied for free, but donations are always welcome.

Installation

  1. Upload the entire simple-paypal-donate folder to your wp-content/plugins/ directory.
  2. Activate the plugin through the ‘Plugins’ menu in WordPress.
  3. There is no options screen – configuration is done in your code.

FAQ

Is there any other advantage to using this plugin rather than the PayPal code?

Yes there is. This code is XHTML compliant. It also makes maintaining your code easier – if PayPal change their code format, one update to this plugin will update all your donation buttons automatically.

Can I apply CSS styles to the donation button?

You can apply CSS styles to the donation button as the button is within form tags and this has an id of donate.

For example, the following CSS will “float” the button to the right hand side…

#donate {float: right;}

Which version of PHP does this plugin work with?

It has been tested and been found valid from PHP 4 upwards.

Contributors & Developers

“Simple PayPal Donate” is open source software. The following people have contributed to this plugin.

Translate “Simple PayPal Donate” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Changelog

1.0

  • Initial release

1.1

  • On some PayPal servers a different version of the code was being used which supplied different parameters. This version takes this into account and allows both types to be specified.

1.2

  • Added sub-parameter option, allowing a TARGET to be specified for links and an override for the ALT text. I’ve made this backward compatible with the parameter options before this version.
  • Modified the default image ALT text

1.3

  • If no TARGET is specified then it is not assigned – TARGET is not compatible with XHTML STRICT
  • Resulting XHTML code is better formatted, with comments identifying code location
  • Confirmed WP 3.0 compatibility and that PayPal code is the latest

1.4

  • Added a shortcode
  • New function to return a direct link to the donation page
  • Code tidy