Paypal Plugin

This is an updated version of the Paypal Plugin for Geeklog, originally developed by Vincent Furia.


  • glFusion v1.6.0 or newer
  • PHP 5.6.0 or higher
  • lgLib plugin 1.0.5 or higher


  • Sell items on your site using Paypal or Amazon SimplePay.
  • PluginIntegration - Plugins may provide items for sale to be included in the catalog. (new, experimental)
    Some possibilities are:
    • Event Fees
    • Site Membership Fees
    • Advertising
  • Support for encrypted Paypal buttons. (new)
    Buttons are automatically created when a product is updated.
  • Support for comments.
  • Support for product ratings.
  • Change to a category table, rather than free-form category strings.
  • Support for multiple product images. Images may be uploaded via the product catalog rather than being uploaded separately.
  • Downloadable products may be uploaded directly from the product form.
  • Search products using glFusion's search.
  • Include product links in other text using AutoTags
  • Track item inventory. Purchases can be blocked if an item is out or stock.
  • Support multiple item options, such as size or color.
  • Multiple payment gateways (API Reference). Gateways have their own configurations and may be disabled.
  • Shopping cart
  • Configurable checkout WorkFlows

Screenshots can be seen in the Gallery.


The Paypal Plugin uses the glFusion automated plugin installer. Simply upload the distribtuion using the glFusion plugin installer located in the Plugin Administration page.

Always back up your database before installing or upgrading a plugin!

The plugin may be installed manually, if necessary.

Manual Installation

  1. Extract the tarball into the private_dir/plugins directory.
  2. Move the public and admin directories
    • Move private_dir/plugins/paypal/public_html to public_html/paypal
    • Move private_dir/plugins/paypal/admin to public_html/admin/plugins/paypal
  3. Create a download log file called paypal_downloads.log in the private_dir/logs directory. Make sure that the web server can read and write to this file.
  4. Create a working directory for creating encrypted PayPal buttons. The default location for this is private_dir/data/paypal, but it can be anywhere the web server can read, write and create files. (If you use a different location, you need to update the plugin configuration accordingly.)
  5. If you are upgrading from version 0.3.2 or earlier, rename your config.php file to config.old.php. Starting with version 0.4.0 all configuration is done through the online configuration system.
  6. Visit {site_url}/admin/plugins.php. Click “Install” next to the PayPal plugin.


The upgrade process is identical to the installation process, simply upload the distribution from the Plugin Administration page.

Upgrading to version 0.4.0

You must back up your database before upgrading the Paypal plugin. This version (0.4.0) is substantially different than previous versions and makes significant changes to the database schema

Other notes:

  • During the upgrade, values from your existing configuration file (config.php) will be loaded into the online configuration system and the file will be renamed to “config.old.php”. If you need to restore an earlier version of the plugin you'll need to rename that file back to “config.php”.
  • Several new fields are added to the product table, among them a field to hold the date when the product was added to the catalog. This may be used in the future to create a “New Products” block or for similar purposes. During the upgrade, this value will be set to the current timestamp.

Summary of Changes in 0.4.0

  • Moved the configuration from config.php to online configuration
  • Added support for creating encrypted PayPal buttons.
  • Added product category table for more structured category assignments.
  • Added donation support.
  • Added support for multiple images uploaded with the product record.
  • Allow selection of file or upload of new one.
  • Added support for physical products. Added new “weight” field for shipping. Shipping can be set up in the PayPal account profile.
  • Added “taxable” field to override PayPal-profile tax setup per item.
  • Expanded currency support to all PayPal-supported currencies.
  • Added selection of button types per product (buy now, add to cart, etc).
  • Added support for plugin-supplied products. Added API functions to allow plugins to generate encrypted and plain buttons.
  • Enhanced the IPN handler to notify plugins of purchases related to them.
  • Integrated with glFusion's site search, added keyword field to products.
  • Added user comment support to products. Enabled by default.
  • Added user ratings support to products (glFusion 1.1.7 or later only).
  • Added purchase notifications to admin.
  • Revised the user interface and product catalog using tabs and admin lists.
  • Added slimbox for viewing expanded thumbnail images.
  • Added blocks for random, popular and featured products.



Autotags can be used to embed product information into a static page or story. The autotag format is

[paypal:product_id optional_text]

Where product_id is the numeric database ID number of the product and optional_text is the text to display in the link. If the text parameter is omitted, then the product name will be shown.


Configuration Options

Configuration Options are set by the Paypal section in the site Configuration area. There is no config.php required unless you wish to override any other settings.

Administrator Email AddressThis is a optional email address of your Paypal administrator. If this is empty, confirmation messages will be sent to the global site_email address.
CurrencySelect the currency that your site uses. Only one currency type is supported.
Anonymous users can buy?Set this to “Yes” to allow anonymous visitors to make purchases. If this is “No”, then visitors must log in before they can purchase items.
Email User upon purchase?Set this to “Yes” to send an email acknowledgment to the buyer. Note that they will also recieve an payment acknowledgment from Paypal, but this allows you to send something similar to an invoice.
Attach files to user's email message?If this is “Yes”, then downloadable files which are purchased will be attached to the acknowledgment email (assuming “Email User upon purchase” is also “Yes”). If this is “No”, then the buyer will need to visit your site to download the purchased file. Note that the buyer can still download the file from your site until the expiration time runs out.
Attach files to anonymous buyer email?This is the same as “Attach files to user's email message” above, but applies specifically to anonymous buyers. If you allow anonymous buyers to purchase downloadable files, then this must be set to “Yes” or the buyer will never be able to get their files.
Notify administrators of purchases?Choose when an administrator will receive an email as a purchase is made. If you are selling physical items that require some intervention on your part (such as shipping the item), you are strongly encouraged to receive notifications at least for physical item sales. The notification email is sent to the configure site email address.
Add to main menu?Setting this value to “Yes” adds a “Products” menu option under the “Extras” menu. If you prefer, you can set this to “No” and manually add a menu option anywhere you like.
Default sort order for product displaySelect the field that will be used initially to sort the product listing.
Max products displayed per pageEnter a number for the maximum number of products to be displayed on a single page in the product list.
Category ColumnsEnter a number for the number of columns used to create the category links at the top of the product listing.
Use internal CSS tabbed menu?If this is “Yes”, then the menu in the product catalog will use the styles defined by the plugin. This gives you the opportunity to customize the look of the menu, if you like. If this is “No”, then the standard glFusion tabbed menu will be used.
Max number of product imagesSet this to the maximum number of images that may be uploaded with a product.
Enable Comments?Select “Yes” to allow site users to add comments to products, similar to articles and other glFusion content. Select “No” to disable comments globally.
Enable Ratings?Select “Yes” to allow products to be rated by site visitors. Select “No” to disable ratings completely.
Enable Left Blocks
Enable Right Blocks
Left and/or Right blocks may be disabled when the product catalog is displayed.
Debug IPN MessagesIf you're having trouble handling the Instant Payment Notification messages from Paypal, enabling this option may help troubleshoot the problem by logging the complete message the the error.log file.
Images and Paths
Max Thumbnail DimensionEnter the maximum size (width or height), in pixels, that a thumbnail may occupy. When thumbnails are created from uploaded images, they will be sized so that the longest dimension does not exceed this value.
Max Image Width
Max Image Height
These are the maximum dimensions, in pixels, that a product image may occupy. When the product images are uploaded, they will be resized to fit within these dimensions while preserving their aspect ratios.
Full path to downloadable filesEnter the complete path to where downloadable files are stored. The default value will be created during the plugin's installation process; if you change this you must make sure that your webserver has permission to read and write to this path. Files uploaded with the product form will be saved in this location.
Max size for downloadable filesEnter the maximum number of megabytes for downloadable files.

Gateway Selection

Version 0.5.0 introduces a modular approach to using multiple payment gateways. By adding a class file under private/plugins/paypal/classes/gateways, and an IPN handler under private/plugins/paypal/classes/ipn, new payment gateways can be used.

Gateways can also be deleted from the configuration.

If you delete a gateway, you will lose all of its configuration including access and secret keys. Be sure that you have these items backed up.

Payment Button Configuration

Each product may have a payment button for “buy_now”, “donate”, or none at all. With multiple payment options, the blocks and product list can become cluttered with payment buttons, so each gateway can be configured whether it will handle the buy_now and/or donate options. (All enabled gateways are available for order checkout.)

Instant Payment Notification

Paypal's Instant Payment Notification (IPN) messages can be used by the plugin to record transactions in its own database, allowing you to review transactions from within the plugin's administration interface.

Further, the IPN messages allow other Paypal-enabled plugins to take action based on the purchase. This may include automatically subscribing the buyer to some site feature, or allowing the buyer to immediately place the classified ad that they purchased.

If you're using the Bad Behaviour plugin, there may be issues with your payment gateways. Check the gateway information page for details.

Product Options (v0.4.5)

Starting with version 0.4.5, you can add atributes to your products such as color or size, and charge more or less depending upon which options are chosen by the buyer.

After creating a product record normally, click the “Attribute List” option in the main PayPal administration menu. Select the product name from the dropdown list.

For the “Attribute Name” field, you can enter a value to create a new attribute, or select from the list of previously created names. Attributes are simply associated by name, so any item named “Color” will be grouped with other “Color” attributes. The selection list primarily helps avoid issues due to typos or misspellings.

For each product/attribute pair, enter a Value, e.g. “Red”, “Large”, etc. and a price. The price is the amount that will be added to the product's base price when the attribute is selected. Enter a negative number to reduce the product price.

For example, if you sell sweaters you may have color options for Red, Blue and Green, and size options for Small, Medium and Large. You may also have an option for Extra-Large, which costs $5.00 extra, and for Yellow sweaters which are discounted $3.00 due to excess inventory.

Each product/attribute pair may be individually disabled, which you might do if you run out of inventory for that item.


Products which have attributes can't be purchased by the “Buy Now” or “Add to Cart” buttons shown on the main product page; the buyer must view the product detail and select the options that they want.

Product Attributes require Javascript- the prices shown in the catalog and submitted to PayPal are updated via Javascript when the selections are changed. Products using attributes also cannot use encrypted Paypal buttons. This offers the opportunity for spoofed purchases where a buyer might submit an order for the expensive options, but change the price to a lower amount. As long as you and your customers are aware that the amount charged Paypal is the authority, this shouldn't present a problem. The product detail screen now displays an error if Javascript is not enabled.

Text Fields

Products can have text fields for the buyer to provide, such as custom engraving instructions. Enter the prompt for each text field in the space provided and separate multiple fields with a pipe “|” character. For example:


Inventory Tracking

This feature is planned for version 0.5.0

These fields have been added to the product record in order to track inventory:

  • Quantity On Hand - The number of items currently available
  • Reorder Level - When the Quantity On Hand falls to this level, then the product should be re-ordered. May provide a “reorder report”.
  • Sell Below QOH? - This is a checkbox indicating that the item may be sold if the Quantity On Hand is depleted. If this is not checked, then the product will not appear in the catalog if the QOH is zero (or less).

When an item is purchased, the quantity given in the IPN message is automatically deducted from inventory. The “Sell Below QOH” flag is not evaluated, since the purchase has already taken place via PayPal.

More than the available quantity may be sold even if “Sell Below QOH” is not checked. For example, if two buyers simultaneously purchase an item that has only one available. Or, if one buyer selects “Add to Cart” and purchases two items when only one is on hand.

Updating the Quantity On Hand when products are received is done manually.

Known Issues

Version 0.4.5

  • The template the “Buy Now” button contained test code to use a PNG image, but the image was not distributed. Starting with line 44 of templates/buttons/btn_buy_now.thtml, change
    <input type="image" src="{site_url}/paypal/images/buynow.png" border="0"
            name="submit" alt="{$LANG_PP['buy_now']}"
            title="{$LANG_PP['buy_now']}" {xhtml}>


      <input type="image" src="{site_url}/paypal/images/buynow.gif" border="0"
            name="submit" alt="{$LANG_PP['buy_now']}"
            title="{$LANG_PP['buy_now']}" {xhtml}>

Version 0.4.3

A couple of issues relating to anonymous access to downloadable products.

  • Download button is displayed to all anonymous users. Once a purchase was made by an anonymous user, “Anonymous” can see the download button until it expires. product.class.php.gz fixes that by blocking all download buttons, except for free products, from anonymous users. Unzip this file in your private/plugins/paypal/classes directory.
  • Emails and files are not properly sent to anonymous users. baseipn.class.php.gz correctly attaches files to anonymous buyers. Unzip this file in your private/plugins/paypal/classes directory.

Version 0.4.0

  • Comments cannot be disabled for individual products.
    A bug in the Product class causes the “Comments Enabled” selection to be ignored. This is fixed in SVN for version 0.4.1. The global comment setting is working; this only affects the per-product comment setting.


This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Copyright © 2009 by Lee Garner

Based upon the Paypal Plugin for Geeklog version 0.2.0 by Vincent Furia (Copyright © 2005-2006 by Vincent Furia).

Logged in as: Guest (anonymous)
glfusion/glpaypal/start.txt · Last modified: 2017/09/21 21:44 by lee
Except where otherwise noted, content on this wiki is licensed under the following license: GNU Free Documentation License 1.3