onlinepayment v1.0.0 released

Sam Tregar sam at
Mon Mar 22 00:30:06 CET 2010

onlinepayment v1.0.0 - a generic Python API for making online payments

This module provides an API wrapper around a variety of payment
providers.  Using this module you can write code that will work the
same regardless of the payment provider in use.


   from onlinepayment import OnlinePayment

   # connect to, setup auth with login and key
   auth= { 'login': 'YOUR LOGIN HERE',
           'key':   'YOUR KEY HERE' }

   op = OnlinePayment('authnet', test_mode=True, auth=auth)

   # or for paypal, setup auth with user, pass, vendor and product:
   auth= { 'username': 'YOUR USERNAME HERE',
           'password': 'YOUR PASSWORD HERE',
           'vendor':   'YOUR VENDOR HERE',
           'product':  'YOUR PRODUCT HERE' }

   # connect to PayPal
   op = OnlinePayment('paypal', test_mode=True, auth=auth)

   # charge a card
       result = = 'Joe',
                        last_name  = 'Example',
                        address    = '100 Example Ln.',
                        city       = 'Exampleville',
                        state      = 'NY',
                        zip        = '10001',
                        amount     = '2.00',
                        card_num   = '4007000000027',
                        exp_date   = '0530',
                        card_code  = '1234')

   except conn.TransactionDeclined:
      # do something when the transaction fails

   except conn.CardExpired:
      # tell the user their card is expired

   except conn.ProcessorException:
      # handle all other possible processor-generated exceptions generically

   # examine result, the values returned here are processor-specific
   success  = result.success
   code     = result.code
   message  = result.message
   trans_id = result.trans_id

   # you can get the raw data returned by the underlying processor too
   orig = result.orig


Before you can use this module you must install one or more payment
processors.  To install the PayPal payflowpro package::

  # easy_install pytz
  # easy_install python-payflowpro

To install the zc.authorizedotnet package and the authorize package
(for recurring support)::

  # easy_install zc.authorizedotnet
  # easy_install authorize

If you want support you'll need to install a patched
version of zc.ssl.  Hopefully someday this will be released by the
Zope devs, but so far I haven't heard anything back.  Download the
zc.ssl source package from, then

  # tar zxvf zc.ssl-1.1.tar.gz
  # cd zc.ssl-1.1

Now download and apply my zc-ssl-timeout.patch::

  # wget
  # patch -p1 < /zc-ssl-timeout.patch

And install the patched module::

  # python install

(You may also need to edit and remove the
'ssl-for-setuptools' dependecy.  I did, although it may be a quirk of
my Python install rather than a general problem.)

Once you have a payment processor you can install this module::

  # easy_install onlinepayment

For more information see:

More information about the Python-announce-list mailing list