This plugin lets you add a PayPal donation sidebar widget and shortcode to WordPress. The options menu lets you setup you PayPal ID and a few other optional settings. You can choose which donation button you want to use or if you want to use your own button. You can also set an optional default purpose and reference which can be overridden on each inserted instance with the widget and shortcode options. There is also settings for currency, custom payment page style and the return page.
PayPal Donations Widget Plugin Installation
- Go to the Add New plugins screen in your WordPress admin area
- Click the upload tab
- Browse for the plugin file (paypal-donations.zip)
- Click Install Now and then activate the plugin
Plugin Usage
Go to the “paypal donations” menu link from the WordPress dashboard settings menu after you install and activate the plugin:
Admin Page Configuration
You need to enter some details for the donation and your PayPal account from the admin interface of the plugin:
 PayPal Account
Your PayPal Email or Secure Merchant Account ID. The donations will go directly to this PayPal account.
Currency
Select the currency the donations will be made in.
Page Style (optional)
The custom page style that associated with the donation button when arriving at the PayPal payment page.
Login to PayPal -> Profile -> Selling Preferences -> Custom Payment Pages, to design your own page style.
Note: Some PayPal accounts have this option located in this place instead:
My Account -> Profile -> My selling tools -> Selling online -> Custom payment pages.
Return Page (optional)
An URL where the user will be returned after completing the payment. For example, a URL on your site that hosts a “Thank you for your donation†page.
Amount (optional)
Set a default amount to be used by the plugin. Use numbers only, like 9.95 or 20 without any currency symbol.
Purpose (optional)
Here you can enter a default purpose for the donation. You can override this purpose when inserting a specific button by using the purpose=â€â€ argument in the shortcode. If no purpose is defined, the user will get the possibility to enter a purpose on PayPal’s payment page.
Reference (optional)
Here you can enter a default reference for the donation. You can override this reference when inserting a specific button by using the reference=â€â€ argument in the shortcode.
Select Button
Here you can select between PayPals three default buttons, or enter an URL to a custom button of your own to use instead.
The last option in this section is language and country. It let’s you localize the graphics of the button to use any of PayPal’s available buttons with translated button graphics. By selecting your intended country when using the button with credit card symbols, they will be adjusted to the ones appropriate for the selected country.
Extras
- Disable PayPal Statistics Enable this to not load the hidden image PayPal uses for statistics. It’s recommended to load the statistics image, but for speed purposes it can be turned off with this option.
- Theme CSS Override: Center Button If the theme you are using do not center form buttons, but you want the Donate button centered, enable this options to center it.
- Set Checkout Language Enable this to override any potential PayPal language cookie the person to donate might have set in the browser, and control the language used for the first PayPal checkout page.
Auto Redirect from PayPal (After Donation Payment)
You can configure auto redirect in your PayPal account using this documentation. This will redirect the visitors to a “Thank You” page after they make a donation.
The Donations Sidebar Widget
Go to Appearance -> Widgets menu from your admin dashboard to add a donations widget to your sidebar. You can enter a few optional settings for the widget.
- A title to appear on the Widget (defaults to Donate)
- A descriptive text to appear above the button (it automatically adds <p></p> around it on display.
- Purpose to override the default purpose.
- Reference to override the default reference.
The Donations Widget Shortcode
You can also use a shortcode to add the donations widget to a WordPress post or page.
Insert the button in your pages or posts with the following shortcode:
[paypal-donation]
Which is the simplest option, and uses all default and optional settings. If you want to make a specific button for a specific purpose you can add the following parameters in the shortcode. Here is an example:
[paypal-donation purpose="Spline Importer" reference="LW3D Plugins"]
Additional Shortcode Parameters
You can optionally add the following arguments to the shortcode:
- purpose
- reference
- amount
- return_page
- button_url
For example, The following shortcode will use a custom button image for the donation button:
[paypal-donation purpose="A good cause" reference="Ref123" button_url="https://example.com/custom-button-image.jpg"]
Using The Donations Widgets in Your Theme’s Template File
Use the following PHP code in your theme’s template file:
<?php echo do_shortcode('[paypal-donation]'); ?>
or the following (if you wanted to use custom parameters):
<?php echo do_shortcode('[paypal-donation purpose="Donation Purpose" reference="Sample Reference"]'); ?>
Filters and Hooks
The following filters are available for hooking into the plugin:
- paypal_donations_amount = Filters the predefined amount before the button is generated.
- paypal_donations_url – Filters the URL the form points to. Useful to change to the PayPal sandbox URL for testing the button.
- paypal_donations_purpose_html – Filters the the default hidden form input element for the purpose.
- paypal_donations_merchant_email – Allows you to override the PayPal merchant email address of the donation button dynamically.
Example Code
function change_donation_amount( $amount ) { // Do something return $amount; } add_filter('paypal_donations_amount', 'change_donation_amount', 10, 1); function change_paypal_url( $url ) { // Do something return $url; } add_filter('paypal_donations_url', 'change_paypal_url', 10, 1); // Add a drop down menu for donation purposes function paypal_purpose( $purpose ) { return ' <select name="item_name"> <option value="Donation Purpose 1">Donation Purpose 1</option> <option value="Donation Purpose 2">Donation Purpose 2</option> </select> '; } add_filter( 'paypal_donations_purpose_html', 'paypal_purpose' ); function override_merchant_email( $pp_email ) { $pp_email = '[email protected]'; return $pp_email; } add_filter('paypal_donations_merchant_email', 'override_merchant_email');
More WordPress Plugins
You can also try our WP Express Checkout plugin to accept PayPal Donations that is handled using the PayPal Express Checkout API. The checkout happens in a popup window.
Check out our WordPress plugins page for more cool WordPress plugins.