MediaWiki extensions manual
OOjs UI icon advanced.svg
Donation Gateway
Release status: unmaintained
Implementation Tag , Special page
Description The donation gateway process is an expandable group of extensions for accepting donations while offering a choice of currency and payment gateway.
Author(s) Four Kitchens (Diana M Dupuistalk)
Latest version 1.0 (2009-08-03)
MediaWiki 1.15
License GPL
Download No link
Translate the DonationGateway extension if it is available at translatewiki.net
Check usage and version matrix.

What Can This Extension Do?Edit

The donation gateway is composed of a group of extensions that allow users to donate funds through various payment gateways and currency types. The process begins with a donation interface form. The form use the tag extension <donate /> which asks for the donation amount, currency and payment method (i.e., Paypal or credit card).

Each of the payment methods is an extension which handles all external communication with the payment service. Each gateway supplies the donation extension with following necessary information (through hooks);

  • form name value
  • form display name
  • currencies accepted
  • and the URL for redirection to the gateway

This user-supplied data is passed to that URL so that the gateway extension can process the donation.

  • amount
  • currency

How You Can HelpEdit

Suggestions for improving security and better wiki-specific integration are welcome and encouraged. Specific issues currently being addressed:

  • More efficient structure of the HTML output so it isn't a big parcel of markup
  • Saving data to the database
  • Check that a currency is offered by a gateway and present the user with only valid options (all gateways currently allow all currencies)

Also, other gateway extensions for other payment options are being developed, the more the merrier.

Current StatusEdit

A special page extension gateway for Payflow Pro is being tested and reviewed, as is a simple redirection to Paypal. The next version of the donation interface will include matching gateways with the currency they accept. There is no data saved locally and order numbers are random, this is being developed in the next phase.

Current Extensions:

  • donate_interface: tag extension to display form on Wiki Page
  • payflowpro_gateway: special page extension to accept credit cards through Payflow Pro
  • paypal_gateway: redirects donation to Paypal (in progress)


Add this tag to your Donate wiki page:

<donate />

The hooks are set up on the extension_name.php page within the extension's directory. Two hooks are required. The gwValue to pass an (expandable) array of data including the form's drop down menu values and currencies accepted. And the gwPage to pass the redirection URL as an array elements. Both hooks must use the same key.

For example, the PayflowPro gateway is set up like this:

//Hooks required to interface with the donation extension (include <donate> on page)
//gwValue supplies the value of the form option, the name that appears on the form
//and the currencies supported by the gateway in the $values array

$wgHooks['gwValue'][] = 'pfpGatewayValue';
$wgHooks['gwPage'][] = 'pfpGatewayPage';

//Hook to register form value and display name of this gateway
//also supplies currencies supported by this gateway
function pfpGatewayValue(&$values) {
  $values['payflow'] = array(
    'gateway' => "payflow",
    'display_name' => "Credit Card",
    'form_value' => "payflow",
    'currencies' => array(
      'GBP' => "GBP: British Pound",
      'EUR' => "EUR: Euro",
      'USD' => "USD: U.S. Dollar",
      'AUD' => "AUD: Australian Dollar",
      'CAD' => "CAD: Canadian Dollar",
      'CHF' => "CHF: Swiss Franc",
      'CZK' => "CZK: Czech Koruna",
      'DKK' => "DKK: Danish Krone",
      'HKD' => "HKD: Hong Kong Dollar",
      'HUF' => "HUF: Hungarian Forint",
      'JPY' => "JPY: Japanese Yen",
      'NZD' => "NZD: New Zealand Dollar",
      'NOK' => "NOK: Norwegian Krone",
      'PLN' => "PLN: Polish Zloty",
      'SGD' => "SGD: Singapore Dollar",
      'SEK' => "SEK: Swedish Krona",
      'ILS' => "ILS: Isreali Shekel",

  return true;

//Hook to supply the page address of the payment gateway
//The user will redirected here with supplied data with input data appended (GET).
//For example, if $url[$key] = index.php?title=Special:PayflowPro
//the result might look like this: http://www.yourdomain.com/index.php?title=Special:PayflowPro&amount=75.00&currency_code=USD&payment_method=payflow
function pfpGatewayPage(&$url) {
  global $wgScript;
  $url['payflow'] = $wgScript. "?title=Special:PayflowProGateway";
  return true;

The Paypal gateway (and all subsequent extensions) are set up the same way:

$wgHooks['gwValue'][] = 'uniqueIDGatewayValue';<br />
$wgHooks['gwPage'][] = 'uniqueIDGatewayPage';

function uniqueIDGatewayValue(&$values) {
  $values['gatway'] = array(
    'gateway' => "gatewayKey",
    'display_name' => "Credit Card",
    'form_value' => "gatewayKey",
    'currencies' => array(
      'GBP' => "GBP: British Pound",
      'EUR' => "EUR: Euro",
      'USD' => "USD: U.S. Dollar"

  return true;

function uniqueIDGatewayPage(&$url) {
  global $wgScript; //if local, otherwise full url http://www.paypal.com/cgi-bin . . .
  $url['gateway'] = $wgScript. "redirection_ url";
  return true;

Payflow Pro Gateway Special Page Settings and OptionsEdit

There are two form markups included in the code for displaying the form - one is a table and one is using fieldsets. Both include classnames for easier CSSing. The fieldsets version is commented out by default but can be switched manually.

The message displayed at the top of the form can be edited in the payflowpro_gateway.i18.php file. It is the from_message option.

Payflow Pro user account settings are defined in the LocalSettings.php file. They are:

//Added Extensions and supply necessary configuration
require_once( "$IP/extensions/donate_interface/donate_interface.php" );

require_once( "$IP/extensions/payflowpro_gateway/payflowpro_gateway.php" );
$wgPayflowProPartnerID = 'PayPal_or_OtherVendor'; //PayPal or original authorized reseller
$wgPayflowProVendorID = 'merchantLoginID'; // paypal merchant login ID
$wgPayflowProUserID = 'userID'; //if one or more users are set up, authorized user ID, else same as VENDOR
$wgPayflowProPassword = 'merchantPassword'; //merchant login password
$wgPayflowProURL = 'https://payflowpro.paypal.com';
$wgPayflowProTestingURL = 'https://pilot-payflowpro.paypal.com'; // Payflow testing URL (currently)

Paypal Gateway SettingsEdit

In the LocalSettings.php file:

require_once( "$IP/extensions/paypal_gateway/paypal_gateway.php" );
$wgPaypalEmail = "yourBusinessEmail; //the one associated with your Paypal account

Download instructionsEdit



To install this extension, add the following to LocalSettings.php :

Donation FormEdit

 require_once( "$IP/extensions/donate_interface/donate_interface.php" );

New GatewayEdit

 require_once( "$IP/extensions/paypal_gateway/paypal_gateway.php" ); 
 $wgPaypalEmail = "yourPaypalBusinessEmail"; // the one associated with your account

 require_once( "$IP/extensions/payflowpro_gateway/payflowpro_gateway.php" );
 $wgPayflowProPartnerID = 'PayPal'; //PayPal or original authorized reseller
 $wgPayflowProVendorID = 'yourVendorID'; // paypal merchant login ID
 $wgPayflowProUserID = 'yourUserID'; //if one or more users are set up, authorized user ID, else same as vendorID
 $wgPayflowProPassword = 'password'; //merchant login password
 $wgPayflowProURL = 'https://payflowpro.paypal.com';
 $wgPayflowProTestingURL = 'https://pilot-payflowpro.paypal.com'; // Payflow testing URL (currently)

To DoEdit

  • Donation Interface needs to check for currencies accepted by gateways
  • PayflowPro Gateway needs to handle address verification logic
  • Better methods for securing Payflow Pro gateway are welcome and encouraged.
  • Caching of the special page. So far, no cache disabling method has ensured that users hitting the "back" button won't see the entered credit card number. Is there any way to ensure this in all browsers? Is is necessary to ensure?
  • More efficient structure of the HTML output so it isn't a big parcel of markup
  • Saving data to the database