Simple PayPal Donate


Simple PayPal Donate is a WordPress plugin that provides a basic ability to display PayPal donation buttons on your blog.

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.

Download

Download Simple PayPal Donate (v1.2, 10/11/2009)

Changelog

Version 1.0

  • Initial release

Version 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. Thanks to John Kalogerakos for highlighting this to me.

Version 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

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 and, optionally, by modifying the plugin.

Configuration

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.co.uk 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 is usually the 7 digit numeric value at the end of the third line of code (“2851382“). If this is not present you may have an encrypted 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 usually the “src” on the 4th line (“https://www.paypal.com/en_GB/i/btn/btn_donateCC_LG.gif“).
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('2851382',
'https://www.paypal.com/en_GB/i/btn/btn_donateCC_LG.gif'); ?>

In the above example, I’ve used my credentials, but you will need to use the details 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.

Alternatively, 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= : override the standard link TARGET of _BLANK.

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 three sub-parameters – the button ID, the link TARGET and the ALT text.

Applying Styles

You can apply CSS styles to the donation button as the button is within a FORM and this has an ID of ‘donate’.

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

#donate {float: right;}

Mentions/Reviews

Review at BlueFur.com

Problems/Queries

Please report any problems, or suggestions for enhancements, to me either via my contact form or by commenting on the appropriate entries on my blog.

Updates

Updates to this and any other of my WordPress plugins will be published on this blog.

Subscribe to my WordPress category feed.


Share with Delicious Share with Digg Share with Facebook Share with LinkedIn Share with MySpace Share with reddit Share with StumbleUpon Share with Twitter

Comments

  1. masya

    all my code is encrypted and no way to find ID

  2. David

    Version 1.1 of the plugin was launched to specifically deal with this issue (it would appear that PayPal generated different code on different servers!). Instead of specifying the missing button ID as the first parameter instead pass the encrypted value.

  3. ITNotes

    Can anyone help me get rid of the white background behind the gif. The gif is oval but it makes it square with this code. I cant seem to add the border=”0″ and make it work correctly.
    Here is the code I am using:

    Add this is my CSS section:
    #donate {
    float:;
    background: #2a2a2a;
    border: 0px solid #2a2a2a;
    Left;
    }

  4. ITNotes

    Can anyone help me get rid of the white background behind the gif. The gif is oval but it makes it square with this code. I cant seem to add the border=”0″ and make it work correctly.
    Here is the code I am using:

    And this is my CSS section:

    #donate {
    float:;
    background: #2a2a2a;
    border: 0px solid #2a2a2a;
    Left;
    }

Pingbacks & Trackbacks

Leave a Comment

All these comments are validated before being placed on the site. I will NOT allow any spam to be shown, I do not follow the links myself and obvious self-promotion of your site is not accepted either.

CAPTCHA Image CAPTCHA Audio
Refresh Image