Building a payment gateway plugin

From Sohowiki
Revision as of 14:56, 19 April 2007 by Soho (Talk | contribs)
Jump to: navigation, search

Page under construction. Steps I (Mike M) went through to teach a guy (Brad R) how to build a payment gateway plugin.

Contents

Notes on terms used in this article

Webmaster/user
The owner of the website that will be installing your payment gateway plugin
Customer/visitor
The webmaster's customer/website visitor who is purchasing something from the webmaster's website and paying for it via the payment gateway your plugin enables.

What type of gateway is it?

There are generally two types of credit card gateways in terms of how they process payments.

On-site gateway
Visitor selects the "pay with credit card" option and is presented with a form (on webmaster's website) where he fills-in his credit card number, etc. On submission of the form the card data is passed to the payment gateway "behind the scenes", results are returned instantly, and customer is directed accordingly (failure page or final invoice on success).
Off-site gateway
Visitor is directed to payment gateway's portal site to complete payment, then sent back (along with order result data) to webmaster's website for final order processing.

The four components of a payment gateway

  1. payment_options.php - Place in sitebuilder admin tool where webmaster fills-in gateway account id and whatever other data is required by the gateway, and can choose your gateway as the primary credit card processor to be used in his website checkout process.
  2. pgm-checkout.php - Outputs payment option choices to website visitor based on what webmaster sets in Payment Options
  3. pgm-payment_gateway.php - Passes the checkout order data to the gateway.
  4. pgm-show_invoice.php - Catches response from gateway and directs website customer accordingly to final invoice (on success) or failure page if payment attempt did not succeed (e.g., because of declined credit card, etc.).

In sitebuilder admin tool

Checkout process on website

1. Payment Options

pgm-checkout.php

  1. Add condition check to output hidden PAY_TYPE form/field if your gateway is set as the primary credit card processor in Payment Options
  2. Add check for your gateway to condition that determines whether to show credit/debit card payment option to website visitor if one of the defined (checked for) credit card gateways is choosen in Payment Options.

pgm-payment_gateway.php

This is the script that .

Personal tools