Subscription plugin, adding a new payment processor

This development guide is a reference for adding new payment processor to Subscription plug-in.

Adding new processor

All processors should be located in processors folder. When creating a new processor files, it's easiest to copy the file structure from an existing one. The files are as follows:

  • info.php contains basic info on gateway, used to show new gateway in the gateway list
  • Gateway class should be named using the following rule: <gateway_name>.class.php, this allows us to load it automatically when needed
  • ipn_url_manager.class.php - URL handler class that handles IPN calls, this file is optional, depends on how the gateway works.
  • img folder contains default subscription button image
  • lang folder contains language files for gateway specific text
  • templates folder contains templates for forms used for gateway (for settings page, for checkout page, and optionally for unsubscribe link, if supported)

All gateway related functionality is encapsulated in gateway class, and it extends Payment_gateway class. To implement gateway specific logic you should overload the following methods:

  • constructor() - set specific fields to their default values
  • set_test_method() - set gateway in test mode, if supported
  • get_settings_form() - generate HTML for settings form, based on VTE template settings.xml
  • register_ipn() / unregister_ipn() - if gateway supports IPN or similar method of server to server notification use this methods to register URL handlers
  • process_ipn() - this method should handle the IPN call, and act upon it
  • subscribe() - generate subscription, usually called from process_ipn() method
  • get_checkout_button() - generates HTML code for checkout form (subscribe button), based on VTE template subscribe.xml
  • save_settings() - used to save gateway specific settings to Configuration table
  • transaction_log() - used to save transaction data to Subscription_log table

For more details on these and other gateway related methods please consult the inline documentation in the code.

Authors/Release notes

V 4.1.5

 
devdoc/plugins/subscription_ipn.txt · Last modified: 2009/09/02 09:13 by boccio
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki