You are here: Home Plone products CMFPaypalHelper

CMFPaypalHelper (0.2)

1
by olena last modified 2008-08-29
0.0
0.0
0.0
0.0
Released on 2008-08-27 by Pilot Systems for Plone 2.0, Plone 2.1, Plone 2.5, Plone 3.0, Plone 3.1 under GPL - GNU General Public License available for All platforms.
Software development stage: stable
CMFPaypalHelper is a simple Zope product (for CMF) to ease the use of online payment using Paypal in CMF sites

Introduction

CMFPaypalHelper is a simple Zope product  (for CMF) to ease the use of online payment using Paypal in CMF sites. It does not contain a cart system, nor any other online shop features.

How to use

Install  the product  in Zope  as  usual. For  a Plone  site, use  the quickinstaller to install the tool. Then, call the 'makePaypalButton' on  the tool to generate a button. A script you wrote will be called  when the payment is validated, so you can process the order.
You can specify  two urls where your customer  will be redirected, one if the payment is complete, one if the payment fails.

makePaypalButton

The 'makePaypalButton'  of the  tool does all  the job for  you. It'll return an HTML fragment which renders as a button doing the payment on Paypal.

You need to specify a cart,  which is just a list of item_name, price, quantity tuples.  Those will  be displayed to  the customer  on Paypal site.  The total  sum of prices*quantity will be  the price charged by Paypal.

You can  also sepcify a currency  (if not, the default  will be used), and two return URLs: one in case of success, one in case of failure.

A  special  'custom'  parameter   will  be  kept  alongside  with  the transaction, and given to your validation function. You can put a cart id or something similar in it.

validatePaypalPayment

Once  a  payment is  validated,  the  validatePaypalPayment script  is called,  using acquisition  (so you  can  put your  own). This  script should  process   with  the  order.   Pay  attention  that's   it's  a server-server call, with no output.

Your script will be  called with two parameters: a 'verification_key', and a  'payment_info'. The 'payment_info' is a  dictionnary with stuff about your  payments, the  most important one  being the  'custom' you gave to 'makePaypalButton'.

The 'verification_key' is  a way to ensure that  this script is really called  from the Paypal  helper tool,  and not  from the  Web (someone trying to  validate a payment that  was not validated  by Paypal). You should  call the 'checkVerificationKey'  on the  tool, giving  it your 'custom' value and the 'verification_key'.

The 'verification_key' is  in fact a cryptographic hash  (md5, but you can change it  to sha1 if you really  need it) of a private  key + the 'custom' value.
Document Actions
Powered by Plone