Simple PayPal Donate



Simple PayPal Donate provides a basic ability to display PayPal donation buttons on your blog.

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.

Licence

This WordPRess plugin is licensed under the GPLv2 (or later).

Support

All of my plugins are supported via my website.

Please feel free to visit the site for plugin updates and development news - either visit the site regularly, follow my news feed or follow me on Twitter (@artiss_tech).

For problems, suggestions or enhancements for this plugin, there is a dedicated page and a forum. The dedicated page will also list any known issues and planned enhancements.

Alternatively, please contact me directly.

This plugin, and all support, is supplied for free, but donations are always welcome.

Reviews & Mentions

Review at BlueFur.com

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.

Frequently Asked Questions

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.

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

Mantis Bug Tracker

Known Bugs

No bugs are currently recorded.

Planned Enhancements

Roadmap View the Roadmap for Simple PayPal Donate
Change Log View the Change Log for Simple PayPal Donate

  1. Add shortcode option [View]
  2. Provide a direct link [View]
  3. Add widget option [View]
Sign up for testking VCP-410 course to become IT expert. Get guaranteed success in real exam using self paced testking 350-001 study guide and testking 640-802 practice exam.

Delicious Digg Facebook LinkedIn Read It Later reddit StumbleUpon Twitter SeparatorEmail Google Translate PDF Online Print Friendly

Support Forum

Please use the forum for reporting any problems, queries or suggestions relating to this plugin.

4 Comments - ARCHIVE

  1. masya says:

    all my code is encrypted and no way to find ID

    • David says:

      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.

  2. ITNotes says:

    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;
    }

    • David says:

      The image is a GIF supplied by PayPal – I suspect they haven’t set transparency on around the image, hence the white is showing. When specifying the details of your donation button via the PayPal site, you can supply your own image – I’d suggest doing this.

14 Pingbacks/Trackbacks

  1. WordPress Plugin Releases for 01/31 | Tips Wordpress wrote:

    [...] Simple PayPal Donate [...]

  2. WordPress Plugin Releases for 01/31 | Wordpress Blog NL wrote:

    [...] Simple PayPal Donate [...]

  3. WordPress Plugin Releases for 01/31 | BlogBroker24-7 wrote:

    [...] Simple PayPal Donate [...]

  4. Wizreport » WordPress Plugin Releases for 01/31 wrote:

    [...] Simple PayPal Donate [...]

  5. [...] 8. Simple Paypal Donate O plugin Simple PayPal Donate é um plugin WordPress que permite fazer doações Paypal de uma forma comoda e simples no seu blog. Ele é também compatível com XHTML, ao contrário do código original do PayPal. [...]

  6. 10 Zeer frisse Wordpress Plug-Ins van 2009 : Edenz wrote:

    [...] Paypal Donatie [...]

  7. WordPress Plugin Releases for 04/11 - Word Press Magazine wrote:

    [...] Simple PayPal Donate [...]

  8. 10 Zeer frisse Wordpress Plug-Ins van 2009 | Wordpress Internet Marketing Tools wrote:

    [...] Een elegante manier van archief splitsen op jouw WordPress website. Ziet er absoluut goed uit, en is makkelijk te installeren. [...]

  9. Latest 10 WordPress Plugins on the Block - FPT Arener – Yes! I Can! wrote:

    [...] Simple Paypal Donate [...]