{ "info": { "author": "Sebastian Wehrmann, Daniel Havlik", "author_email": "sw@gocept.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: Zope Public License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Internet :: WWW/HTTP" ], "description": "With this package you can easily use the PayPal NVP API in your Python or\nZope / Plone based environment. It supports the ExpressCheckout and\nDirectPayment API from PayPal.\n\nYou will need a `PayPal Developer Account `_.\n\nPlease note, that the DirectPayment API does only work with US or UK\nbusiness accounts.\n\n\n===============\n gocept.paypal\n===============\n\n\nBase setup\n==========\n\n\nFirst we need to import some packages and setup a testbrowser:\n\n >>> import cgi\n >>> import os\n >>> import urlparse\n >>> import zope.component\n >>> import gocept.paypal.paypal\n >>> import gocept.paypal.interfaces\n >>> from zc.testbrowser.browser import Browser\n >>> browser = Browser()\n >>> browser.mech_browser.set_handle_robots(False)\n >>> callback_url = os.environ['pp_api_callback_url']\n >>> callback_cancel_url = os.environ['pp_api_callback_cancel_url']\n\n\nThen, we need a PayPalDataProvider, which provides our PayPal API with the\ninformation about your PayPal buisness account and API Credentials:\n\n >>> class PPData(object):\n ... zope.component.adapts(gocept.paypal.interfaces.IPayPal)\n ... zope.interface.implements(\n ... gocept.paypal.interfaces.IPayPalDataProvider)\n ...\n ... username = os.environ['pp_api_username']\n ... password = os.environ['pp_api_password']\n ... signature = os.environ['pp_api_signature']\n ... version = os.environ['pp_api_version']\n ... api_endpoint = os.environ['pp_api_endpoint']\n ... paypal_url = os.environ['pp_api_url']\n ... currency = os.environ['pp_currency']\n ...\n ... def __init__(self, context):\n ... self.context = context\n\n\nRegister the DataProvider at the SiteManager:\n\n >>> gsm = zope.component.getGlobalSiteManager()\n >>> gsm.registerAdapter(PPData)\n\n\nThis test runs in development mode, which means, that only virtual money is\nbeing tranfered. To get the things work, we have to be logged in at the\nPaypal Developer Site. In productive environment, this step is not needed:\n\n >>> browser.open('https://developer.paypal.com/')\n >>> browser.getControl(name='login_email').value =\\\n ... os.environ['pp_dev_username']\n >>> browser.getControl(name='login_password').value =\\\n ... os.environ['pp_dev_password']\n >>> browser.getControl(name='submit').click()\n >>> 'Now loading,' in browser.contents\n True\n\n\nUsing the PayPal ExpressCheckout API\n====================================\n\n\nSetup the paypal API:\n\n >>> paypal = gocept.paypal.paypal.PayPal()\n\n\nWe now make a new payment request with the amount $1,00 and get back a token\nfrom the API. callback_cancel_url is the url, PayPal will redirect the buyer,\nif he manually cancels the transaction. In all other circumstances,\ncallback_url will be used.\n\n >>> amt = 1\n >>> token = paypal.SetExpressCheckout(amt, callback_url,\n ... callback_cancel_url)\n\n\nCall the paypal site with the token as an argument, login and click continue.\nThis step is in production environment done by the buyer.\n\n >>> url = '%s%s' % (os.environ['pp_api_url'], token)\n >>> browser.open(url)\n >>> browser.getControl(name='login_email').value =\\\n ... os.environ['pp_buyer_username']\n >>> browser.getControl(name='login_password').value =\\\n ... os.environ['pp_buyer_password']\n >>> browser.getControl(name='login.x').click()\n >>> browser.mech_browser.set_handle_redirect(False)\n >>> browser.getControl(name='continue.x', index=0).click()\n Traceback (most recent call last):\n ...\n httperror_seek_wrapper: HTTP Error 302: Found\n >>> browser.mech_browser.set_handle_redirect(True)\n\n\nThe User is now redirected to the callback_url. The token is submitted as a\nGET parameter which we need to catch:\n\n >>> url = browser.mech_browser.response().hdrs['location']\n >>> query_string = urlparse.urlparse(url)[4]\n >>> token = cgi.parse_qs(query_string)['token'][0]\n\n\nWith the token, we now can, but must not, call GetExpressCheckoutDetails,\nwhich returns some information about the buyer and the status of his\ntransaction. In most cases the call is neccessary to get the payerid, which\nis needed to finalize the process:\n\n >>> express_tokens = paypal.GetExpressCheckoutDetails(token, callback_url,\n ... callback_cancel_url)\n >>> express_tokens['ACK'] == 'Success'\n True\n\n\nTo complete the transaction, we must call the DoExpressCheckoutPayment with\nmany information about the transaction:\n\n >>> payerid = express_tokens['PAYERID']\n >>> pay_tokens = paypal.DoExpressCheckoutPayment(\n ... express_tokens['TOKEN'], payerid, amt, callback_url,\n ... callback_cancel_url)\n\n\nThe pay_tokens dictionary holds all neccessary information about the\ncompleted transaction. In the test case we only check, if everything is fine:\n\n >>> pay_tokens['ACK']\n 'Success'\n\n\nControlling the Payment Process\n-------------------------------\n\nSometimes it is nessesary to change the default payment process. One\ncase could be to show the payer not the login page, but already the\nbilling page. It could be handy, if there is a percentage of users\nwithout a PayPal account.\n\nTo control the process, we use additional keyword arguments for\nSetExpressCheckout:\n\n >>> amt = 1\n >>> token = paypal.SetExpressCheckout(amt, callback_url,\n ... callback_cancel_url,\n ... LANDINGPAGE='Billing')\n\nCall the paypal site with the token as an argument, login and click continue.\nThis step is in production environment done by the buyer.\n\n >>> url = '%s%s' % (os.environ['pp_api_url'], token)\n >>> browser.open(url)\n >>> print browser.contents\n >> browser.getControl(\"First Name\")\n \n\n\nUsing the DirectPayment API:\n============================\n\n\nIf you buyers do not have a PayPal Account or you want to accept creditcard\nbased direct payments, you may user the DoDirectPayment API, which needs some\nextra info like creditcard number and so on. Please refer to the PayPal API\ndocumentation for more info.\n\n >>> pay_direct_token = paypal.DoDirectPayment(\n ... 1.00,\n ... '192.168.0.1',\n ... os.environ['pp_buyer_cc_number'],\n ... '052018',\n ... '123',\n ... 'David',\n ... 'Duchovny',\n ... 'VISA',\n ... 'Mainstreet 21',\n ... 'New York',\n ... 'NY',\n ... '12345',\n ... callback_url,\n ... callback_cancel_url,\n ... )\n >>> pay_direct_token['ACK']\n 'Success'\n\n\nChanges\n=======\n\n\n0.1.10 (2010-03-30)\n-------------------\n\n- allow keyword arguments for SetExpressCheckout to control the payment\n process.\n\n\n0.1.9 (2008-06-26)\n------------------\n\n- bugfix release\n\n\n0.1.8 (2008-05-17)\n------------------\n\n- improved the way, the token is fetched from the callback url\n- fixed a bug in DoDirectPayment causing PayPal to always ask for an item\n amount\n\n\n0.1.7 (2008-05-16)\n------------------\n\n- started recording changelog\n- fixed a bug with multiple continue-buttons on paypals website causeing the\n tests to crash\n- added support to specify the currency of transactions (was USD only)\n- moved paypal login information to buildout.cfg\n- improved documentation", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://pypi.python.org/pypi/gocept.paypal/", "keywords": "zope3 gocept paypal", "license": "ZPL 2.1", "maintainer": null, "maintainer_email": null, "name": "gocept.paypal", "package_url": "https://pypi.org/project/gocept.paypal/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/gocept.paypal/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://pypi.python.org/pypi/gocept.paypal/" }, "release_url": "https://pypi.org/project/gocept.paypal/0.1.10/", "requires_dist": null, "requires_python": null, "summary": "Paypal Utility providing the paypal API", "version": "0.1.10" }, "last_serial": 792574, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "5594b4d935d34a7dae4859aee65ec2dd", "sha256": "7a560ae90d9a90fb135ab7592aa484dafcda1ebb890bb8a18c45113efb165d19" }, "downloads": -1, "filename": "gocept.paypal-0.1.tar.gz", "has_sig": false, "md5_digest": "5594b4d935d34a7dae4859aee65ec2dd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6350, "upload_time": "2007-11-23T10:44:46", "url": "https://files.pythonhosted.org/packages/ce/44/0e2efcbf44f91dcca8b1b7cfdb158252050dc06526a46e4a748d75d8b86b/gocept.paypal-0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "2212211ccf10f9b65eabf632637f4546", "sha256": "826f89a16343978bdad992e4f76f45472083d92f84b3214f940abca447783520" }, "downloads": -1, "filename": "gocept.paypal-0.1.1.tar.gz", "has_sig": false, "md5_digest": "2212211ccf10f9b65eabf632637f4546", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6376, "upload_time": "2007-11-26T12:34:01", "url": "https://files.pythonhosted.org/packages/42/d5/de445ffe29f2c2c449abcd7c2d40f80df09454ad44210896915d7632f280/gocept.paypal-0.1.1.tar.gz" } ], "0.1.10": [ { "comment_text": "", "digests": { "md5": "c74e3d3ed2b6d52ef9e18b7ccbbc75be", "sha256": "159ae398c850c717a5992a7ed948d29c409afdbb02c433df9181ab622679929c" }, "downloads": -1, "filename": "gocept.paypal-0.1.10.tar.gz", "has_sig": false, "md5_digest": "c74e3d3ed2b6d52ef9e18b7ccbbc75be", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8740, "upload_time": "2010-03-30T08:11:26", "url": "https://files.pythonhosted.org/packages/eb/f1/c6e7a57b93481b4d6fc7d8480d0d617c58cc52900180448374a0cf4edd88/gocept.paypal-0.1.10.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "3ab04f2e70c66fe77256c59c42e879d1", "sha256": "acf201c1e3b8057a0d79dcb7a7391eefc81e9f49be0f4b5daf8991a23342623b" }, "downloads": -1, "filename": "gocept.paypal-0.1.2.tar.gz", "has_sig": false, "md5_digest": "3ab04f2e70c66fe77256c59c42e879d1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6369, "upload_time": "2007-11-26T12:39:49", "url": "https://files.pythonhosted.org/packages/b4/4f/68ef713b5ceb7716deabcc09745a8fbc76a3d24233ac9e6da4f1154ace01/gocept.paypal-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "cfd313191ae15d44d0c2653b842b8684", "sha256": "7e4495027ea3b755d6b0d2cf752a23be32d406c3e0a762d5f0b2ac36b5acc733" }, "downloads": -1, "filename": "gocept.paypal-0.1.3.tar.gz", "has_sig": false, "md5_digest": "cfd313191ae15d44d0c2653b842b8684", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6368, "upload_time": "2007-11-26T12:48:27", "url": "https://files.pythonhosted.org/packages/5b/fa/b1c18beff893104d008c751109c63883edb60eed87738ef1b2f571ac0501/gocept.paypal-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "227e68a0ec89544d755a8946856c1c87", "sha256": "37518052a8f5f363b1c5771a104957e47715d5b3adf55a3480090a231d6c344a" }, "downloads": -1, "filename": "gocept.paypal-0.1.4.tar.gz", "has_sig": false, "md5_digest": "227e68a0ec89544d755a8946856c1c87", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6394, "upload_time": "2007-11-26T13:01:42", "url": "https://files.pythonhosted.org/packages/62/7c/45e567c4d7ee5468483f8e3f619bc15b4e9e5c5c01abec31aecd91e24a69/gocept.paypal-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "914534d1311f11f820db52d95e0057cc", "sha256": "c76d85cf45d6724d99afe21cf710df0b6f0a015af9574157716ce2fc815efd1b" }, "downloads": -1, "filename": "gocept.paypal-0.1.5.tar.gz", "has_sig": false, "md5_digest": "914534d1311f11f820db52d95e0057cc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6442, "upload_time": "2007-11-26T15:16:05", "url": "https://files.pythonhosted.org/packages/ca/39/8e8638f85510194431da15ff007ecb364f7ddf6966c9f6f0ed1098fdcb00/gocept.paypal-0.1.5.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "2c14550781e1ee2527acaa1f77ba631f", "sha256": "338551d4bd20e3a6e8385c93c0d77fbd7eaccbd2d51405e68e20bf6e94811365" }, "downloads": -1, "filename": "gocept.paypal-0.1.6.tar.gz", "has_sig": false, "md5_digest": "2c14550781e1ee2527acaa1f77ba631f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6446, "upload_time": "2007-11-27T13:38:49", "url": "https://files.pythonhosted.org/packages/11/66/8869357265c3480b5e6e412cacd57658de83775e80a5f9c9424268c5c97f/gocept.paypal-0.1.6.tar.gz" } ], "0.1.8": [ { "comment_text": "", "digests": { "md5": "412bc863d2d5643c44eb727dcaee0faf", "sha256": "ca00533140b701665c86d4fe91df85f9853cf644e709235ed489388f1652e8cb" }, "downloads": -1, "filename": "gocept.paypal-0.1.8.tar.gz", "has_sig": false, "md5_digest": "412bc863d2d5643c44eb727dcaee0faf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9566, "upload_time": "2008-05-17T08:15:53", "url": "https://files.pythonhosted.org/packages/ff/e8/ba09f6d6c6095b3b51a8534618e05a63d40cc9bebf7b656a3fa6d0dc7ba9/gocept.paypal-0.1.8.tar.gz" } ], "0.1.9": [ { "comment_text": "", "digests": { "md5": "ca432dcd2f5e14b35f083f417cec23a3", "sha256": "05095f2c1122e873a7987d82f8e45394caad2e724744fb28fd27b16e2696c656" }, "downloads": -1, "filename": "gocept.paypal-0.1.9.tar.gz", "has_sig": false, "md5_digest": "ca432dcd2f5e14b35f083f417cec23a3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9238, "upload_time": "2008-06-26T11:14:43", "url": "https://files.pythonhosted.org/packages/b6/26/0234f4aeaec0e6d9d668c762e5cd368bc3d1dc3712f1829e61ca27e5f481/gocept.paypal-0.1.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c74e3d3ed2b6d52ef9e18b7ccbbc75be", "sha256": "159ae398c850c717a5992a7ed948d29c409afdbb02c433df9181ab622679929c" }, "downloads": -1, "filename": "gocept.paypal-0.1.10.tar.gz", "has_sig": false, "md5_digest": "c74e3d3ed2b6d52ef9e18b7ccbbc75be", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8740, "upload_time": "2010-03-30T08:11:26", "url": "https://files.pythonhosted.org/packages/eb/f1/c6e7a57b93481b4d6fc7d8480d0d617c58cc52900180448374a0cf4edd88/gocept.paypal-0.1.10.tar.gz" } ] }