{ "info": { "author": "Simon Fransson", "author_email": "simon@dessibelle.se", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Topic :: Software Development" ], "description": "Python Payer API\n================\n\n|Build Status| |Coverage Status| |Latest Version|\n\nPython package for interacting with the `Payer `__\npayments API.\n\nThe scope of this module is basically to serialize the data into XML\nready for transmitting to Payer. Given order details, billing details\nand callback URLs it will build an XML tree, encode it according to the\nPayer specifications and return the encoded data along with the required\nkey-value pairs in a dict. Payer expects this data in a POST request\nusing an ``application/x-www-form-urlencoded`` content type.\n\nGenerating HTML, providing any type of request handlers or views needed\nfor a successful payment procedure however, is outside the scope of this\nmodule. Such implementations are encouraged to be realized as\nindependent modules, in relation to the frameworks, webshop modules etc.\nthat you may be using. One such example is\n`django-shop-payer-backend `__\nfor which python-payer-api was initially developed.\n\nInstallation\n------------\n\n::\n\n pip install python-payer-api\n\nBasic usage\n-----------\n\n.. code:: python\n\n from payer_api import PAYMENT_METHOD_CARD, PAYMENT_METHOD_BANK, PAYMENT_METHOD_PHONE, PAYMENT_METHOD_INVOICE\n from payer_api.postapi import PayerPostAPI\n from payer_api.order import (\n PayerProcessingControl,\n PayerBuyerDetails,\n PayerOrderItem,\n PayerOrder,\n )\n\n api = PayerPostAPI(\n agent_id=\"AGENT_ID\",\n key_1=\"6866ef97a972ba3a2c6ff8bb2812981054770162\",\n key_2=\"1388ac756f07b0dda2961436ba8596c7b7995e94\",\n payment_methods=[PAYMENT_METHOD_CARD, PAYMENT_METHOD_BANK, PAYMENT_METHOD_PHONE, PAYMENT_METHOD_INVOICE]\n )\n\n\n processing_control = PayerProcessingControl(\n success_redirect_url=\"http://localhost/webshop/thankyou/\",\n authorize_notification_url=\"http://localhost/webshop/auth/\",\n settle_notification_url=\"http://localhost/webshop/settle/\",\n redirect_back_to_shop_url=\"http://localhost/webshop/\",\n )\n\n order = PayerOrder(\n order_id=\"123456\",\n buyer_details=PayerBuyerDetails(\n first_name=\"John\",\n last_name=\"Doe\",\n address_line_1=\"1234 Main Street\",\n postal_code=\"12345\",\n city=\"Anywhere\",\n phone_mobile=\"012345678\",\n email=\"john.doe@host.com\",\n ),\n order_items=[\n PayerOrderItem(\n description='A product',\n price_including_vat=123.50,\n vat_percentage=25,\n quantity=4,\n ),\n PayerOrderItem(\n description='Another product',\n price_including_vat=123.0,\n vat_percentage=12.5,\n quantity=2,\n ),\n ],\n info_lines=[\n \"Shipping with 5 work days\",\n \"Additional line of order info\",\n ]\n )\n\n api.set_order(order)\n api.set_processing_control(processing_control)\n\n print api.get_post_data()\n\nPayment Process\n---------------\n\nThe main flow of the payment process is as follows:\n\n1. Initialize a ``PayerPostAPI`` object using the Agent ID, Key 1 and\n Key 2 values supplied by Payer. Optinally set ``test_mode`` and\n ``debug_mode`` and add a list of ``payment_methods``.\n2. Create a ``PayerProcessingControl`` object and add it to your API\n object using the ``set_processing_control()`` method. This object\n holds four URL's that your site has to provide. They are:\n \u00a0\n ``success_redirect_url``: A \"thank you\" URL, displayed after\n completed purchase\n ``authorize_notification_url``: A callback URL, described below,\n called when orders are authorized.\n ``settle_notification_url``: A callback URL, described below, called\n when orders are payed.\n ``redirect_back_to_shop_url``: A \"cancel\" or \"back to shop\" URL.\n \u00a0\n3. Create a ``PayerOrder`` object (including ``PayerBuyerDetails`` and\n ``PayerOrderItem`` objects) and add it to your API object using the\n ``set_order()`` method.\n4. You can now call ``api.get_post_data()`` for a dict of the query\n parameters Payer expects. Add them as ````\n elements in a ``
`` element with method ``POST`` and action\n ``api.get_post_url()`` and have the user submit the form (i.e. needs\n to happen in front-end).\n5. Payer will parse your order, and once the payment has been completed\n Payer will perform a GET request to your callback URL's - the\n ``authorize_notification_url`` URL, and depending on payment method\n (direct / invoice) call the ``settle_notification_url`` URL. You will\n want to implement a view or URL handler that listens on these URL's,\n for which you call the ``validate_callback_ip()`` and\n ``validate_callback_url()`` methods on PayerPostAPI. A couple of\n query parameters will be appended to the callback URL's, from which\n you can extract the Order ID, selected payment method, payment ID\n etc. The complete list of query paramters are:\n \u00a0\n ``order_id``, ``payer_callback_type``, ``payer_testmode``,\n ``payer_payment_type``, ``payer_added_fee``,\n ``payer_merchant_reference_id``, ``payer_payment_id``,\n ``payread_payment_id``.\n \u00a0\n Depending on the validity of the requests, your view should return\n either ``TRUE`` or ``FALSE`` using a ``text/plain`` content type.\n6. Once Payer has performed its auth and settle validation it will\n redirect the user the the ``success_redirect_url`` URL.\n\n.. |Build Status| image:: https://travis-ci.org/dessibelle/python-payer-api.svg?branch=master\n :target: https://travis-ci.org/dessibelle/python-payer-api\n.. |Coverage Status| image:: https://coveralls.io/repos/dessibelle/python-payer-api/badge.svg?branch=master\n :target: https://coveralls.io/r/dessibelle/python-payer-api?branch=master\n.. |Latest Version| image:: https://pypip.in/version/python-payer-api/badge.svg?style=flat\n :target: https://pypi.python.org/pypi/python-payer-api/", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/dessibelle/python-payer-api/archive/0.1.2.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/dessibelle/python-payer-api", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "python-payer-api", "package_url": "https://pypi.org/project/python-payer-api/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/python-payer-api/", "project_urls": { "Download": "https://github.com/dessibelle/python-payer-api/archive/0.1.2.tar.gz", "Homepage": "https://github.com/dessibelle/python-payer-api" }, "release_url": "https://pypi.org/project/python-payer-api/0.1.2/", "requires_dist": null, "requires_python": null, "summary": "Python package for interacting with the Payer payments API (http://www.payer.se).", "version": "0.1.2" }, "last_serial": 1418400, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "5978afdd316341217932265278dbf88a", "sha256": "8f2a717002d742192a9c6b3e77d09d16f2ef91696520d18c630c2a8df20555a9" }, "downloads": -1, "filename": "python-payer-api-0.1.0.tar.gz", "has_sig": false, "md5_digest": "5978afdd316341217932265278dbf88a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5095, "upload_time": "2015-01-29T23:26:52", "url": "https://files.pythonhosted.org/packages/6f/9a/1c37801a02941ce62c0cdb8e2a9620198801c590b824daf654b1538c4bca/python-payer-api-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "60a8b1ce6c9bac6410cc58180cd35fb3", "sha256": "70316059236b5baca56232a67e7bee66c2c9f52ed979cbe4f0cc58ac6f08328e" }, "downloads": -1, "filename": "python-payer-api-0.1.1.tar.gz", "has_sig": false, "md5_digest": "60a8b1ce6c9bac6410cc58180cd35fb3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8714, "upload_time": "2015-02-01T12:41:06", "url": "https://files.pythonhosted.org/packages/30/1c/bbbeb139df792f448a78c377f6465be436a03bb2f2b5640444c9f70f4bca/python-payer-api-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "e29fa8967aa33b71f81730016ffc8f93", "sha256": "70147b8a3a58a9e63150f15b25926b6f25508f607a8f936844323276fc0b83fb" }, "downloads": -1, "filename": "python-payer-api-0.1.2.tar.gz", "has_sig": false, "md5_digest": "e29fa8967aa33b71f81730016ffc8f93", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10205, "upload_time": "2015-02-10T21:24:56", "url": "https://files.pythonhosted.org/packages/d1/ff/9e887ab95ebadf703f80e8007007b4748c50a6dfe81ea427d05f04326053/python-payer-api-0.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e29fa8967aa33b71f81730016ffc8f93", "sha256": "70147b8a3a58a9e63150f15b25926b6f25508f607a8f936844323276fc0b83fb" }, "downloads": -1, "filename": "python-payer-api-0.1.2.tar.gz", "has_sig": false, "md5_digest": "e29fa8967aa33b71f81730016ffc8f93", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10205, "upload_time": "2015-02-10T21:24:56", "url": "https://files.pythonhosted.org/packages/d1/ff/9e887ab95ebadf703f80e8007007b4748c50a6dfe81ea427d05f04326053/python-payer-api-0.1.2.tar.gz" } ] }