{
"info": {
"author": "Palo Sopko",
"author_email": "pavol.sopko@backbone.sk",
"bugtrack_url": null,
"classifiers": [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Libraries :: Python Modules"
],
"description": "# Cheddar Bindings for Python\n\nA Python wrapper for Cheddar's application interface. Cheddar is a payment gateway for processing and executing transactions within a neat and universal API.\n\nAt the moment, the following payment methods and services are supported by Cheddar and this library:\n\n- CardPay with optional addition for ComfortPay service \u2013 Tatra banka, a.s.\n- TatraPay \u2013 Tatra banka, a.s.\n- ePlatby V\u00daB \u2013 V\u00daB, a.s.\n- V\u00daB eCard \u2013 V\u00daB, a.s.\n- SporoPay \u2013 Slovensk\u00e1 sporite\u013ena, a.s.\n- iTerminal \u2013 Po\u0161tov\u00e1 banka, a.s.\n- GP webpay \u2013 Global Payments Europe, s.r.o.\n- PayPal \u2013 PayPal (Europe) S.\u00e0 r.l. et Cie, S.C.A.\n\nTo see what is new or changed in the current version, check out the [changelog](https://github.com/backbonesk/cheddar-python/blob/master/CHANGELOG.md).\n\n## Setup\n\nYou can install this package by using `pip`:\n\n\tpip install cheddarpayments\n\nIf you fancy `pipenv` use:\n\n\tpipenv install cheddarpayments\n\nTo install from source, run:\n\n\tpython setup.py install\n\nFor the API client to work you would need Python 2.7+ or Python 3.4+.\n\n## Usage\n\nFirst off, you need to require the library and provide authentication information by providing your user handle and shared secret you got from the provider.\n\n```python\nimport cheddar\n\nclient = cheddar.Cheddar(\n cheddar.Configuration(\n cheddar.Environment.Production,\n \"TEST\",\n \"00000000000000000000000000000000\",\n )\n)\n```\n\nIn case you'd like to use the sandbox mode use `cheddar.Environment.Sandbox` when creating configuration object. You can also create your own environment pointing to any valid URL with Cheddar instance running:\n\n my_test_environment = cheddar.Environment(\"test\", \"https://my.cheddar.test\")\n\n**Please note** that only V\u00daB eCard, iTerminal, GP webpay and PayPal currently allow for using their test environments so in case of other providers production URLs will be used! When using sandbox with supported bank or financial institution never use real world credit cards / accounts for testing payment methods implementation (they will not work). Always use virtual testing cards / accounts provided for this purpose by the payment institution.\n\n### Creating a transaction\n\nIt is quite simple to instantiate a payment.\n\nHere\u2019s a quick piece of example code to get you started which will call the Cheddar service and retrieve UUID \u2013 universal identifier of the transaction and set the transaction status to `none` (see next section for more on transaction statuses).\n\n```python\npayment = client.payments.create(\n cheddar.Service.CARDPAY,\n {\n \"amount\": Decimal('9.99'),\n \"currency\": cheddar.Currency.EUR,\n \"variable_symbol\": \"1000000000\",\n \"description\": \"My first test payment\",\n \"payer_name\": \"John Doe\",\n \"payer_email\": \"john@doe.com\",\n \"return_url\": \"https://my-test-server.dev\",\n \"notification_url\": \"https://my-test-server.dev\",\n },\n)\n```\n\nWhen using the wrapper in web context, the user's IP is automatically added to the data array from the environment variables. If you wish to provide your own, add `payer_ip_address` key with valid address as a value.\n\nFirst argument is a service provider, which can currently be one of the following:\n\n| Service name | Description |\n|:-------------|:------------|\n|`cheddar.Service.SPOROPAY`|SporoPay, Slovensk\u00e1 sporite\u013e\u0148a|\n|`cheddar.Service.TATRAPAY`|TatraPay, Tatra banka|\n|`cheddar.Service.CARDPAY`|Cardpay, Tatra banka|\n|`cheddar.Service.EPLATBY`|ePlatby, V\u00daB|\n|`cheddar.Service.ECARD`|eCard, V\u00daB|\n|`cheddar.Service.PAYPAL`|PayPal Payments Standard, PayPal|\n|`cheddar.Service.GPWEBPAY`|GP webpay, Global Payments Europe|\n|`cheddar.Service.ITERMINAL`|iTerminal, Po\u0161tov\u00e1 banka|\n\nSecond argument to the function call is an associative array of configuration options. Which options have to be used and which have no effect at all depends on the service provider. The next table lists all possible attributes:\n\n| Attribute name | Data type | Required? | Notes |\n|:---------------|:---------:|:---------:|:------|\n|`amount`|float|\u2713|amount required in the specified currency|\n|`currency`|string|\u2713|currency code as in [ISO 4217](http://www.iso.org/iso/home/standards/currency_codes.htm)|\n|`variable_symbol`|string|\u2713| |\n|`constant_symbol`|string| | |\n|`card_id`|string| |optional card token in periodical payments
_applicable only to ComfortPay transactions_|\n|`payer_name`|string|\u2713|customer\u2019s name|\n|`payer_email`|string|\u2713|customer\u2019s email (which has to be a valid e-mail address)|\n|`language`|string| |customer\u2019s language|\n|`description`|string| |reference for the customer|\n|`reurn_url` or `callback`|string|\u2713|URL to return to after the payment
_iTerminal does not use this attribute since you have to set this up once for all transactions in their administration interface_|\n|`notification_url`|string| |URL to send notifications to
_required for PayPal transactions_|\n|`cpp_logo_image`|string| |header image at PayPal
_applicable only to PayPal transactions_|\n|`cpp_cart_border_color`|string| |HEX code of colour at PayPal
_applicable only to PayPal transactions_|\n|`periodicity`|integer| |periodicity in days, when the next periodical payment will be automatically executed; default value is 30 days
_applicable only to ComfortPay transactions_|\n\nNote that all of the supported currencies are available as a simple constant on `cheddar.Currency` class to make it easier in code.\n\nAfter the call you can inspect the returning `Payment` object, which is described in the `Getting transaction details` part of this document.\n\nTo get to the URL of a payments gateway at the bank where the payment is processed just redirect the user to value of `payment.redirect_url` property.\n\nAfter the payment process at the payment gateway is finished, you will be redirected to the URL you specified in `return_url` / `callback` parameter during the create call in the example above. The URL will have two more GET parameters added - `uuid`, for the payment identifier and `status`, for the current status of the payment transaction (for some payment methods this may change in time, and you will be notified about the change to the URL you specified in the `notification_url` parameter [see the `Asynchronous transaction notifications` part of this document for more info])\n\n\n#### Allowed transaction statuses\n\n|Status name|Description|\n|:----------|:----------|\n|`none`|transaction has been created, but the user has not been redirected to bank\u2019s payment gateway|\n|`in_progress`|user has been redirected to bank\u2019s payment gateway|\n|`completed`|transaction has been successfully completed|\n|`denied` or `rejected`|transaction has been rejected by the bank (the most usual reasons include user error in inputting card details and insufficient funds)|\n|`timeout`|special temporary status used only by Tatra banka\u2019s TatraPay service|\n|`pending`|special status for PayPal before an IPN notification has resolved the transaction status as either rejected or completed|\n|`cancelled`|in case of periodical payments available only with Tatra banka\u2019s ComfortPay service this status means that planned transaction has been cancelled|\n|`expired`|old payment without clear result (e.g. user abandoned the payment form while at bank\u2019s gateway)|\n\n### Getting transaction details\n\nTo get all details of an existing payment transaction simply pass the UUID of the payment to the following method:\n\n```python\npayment = client.payments.details(uuid)\n```\n\nAfterwards you can inspect the returning object, which contains these properties:\n\n|Property name|Data type|Always present?|Default value|Notes|\n|:------------|:-------:|:-------------:|:-----------:|:----|\n|`uuid`|string|\u2713| | |\n|`status`|string|\u2713|none|current transaction status (see the next table)|\n|`variable_symbol`|string|\u2713| |the same as was sent while creating the payment object (see previous section)|\n|`constant_symbol`|string|\u2713|0308|payment for services|\n|`amount`|float|\u2713|0.00|original amount of the transaction|\n|`refunded_amount`|float|\u2713|0.00|refunded amount of the transaction|\n|`service_fee_amount`|float|\u2713|0.00|provision for the transaction in card payments _available when using CardPay / ComfortPay and set up with PGP encrypted statements or PayPal service_|\n|`currency`|`Currencies`|\u2713|EUR|currency of the transaction|\n|`periodicity`|integer| |0|number of days in which next payment will be executed|\n|`periodicity_no`|integer| |1|number of transaction in order (using the same variable symbol)|\n|`charge_on`|`Datetime`| | |when was or should be this transaction executed|\n|`card_expire_on`|`Datetime`| |null|date of card expiration _available only when using ComfortPay or V\u00daB eCard service_|\n|`card_no`|string| | |masked card number _available only when using ComfortPay or V\u00daB eCard service_|\n|`transaction_identifier`|string| | |internal transaction identifier of the bank _available only when using CardPay / ComfortPay, TatraPay or V\u00daB eCard service_|\n\n### Asynchronous transaction notifications\n\nTransactions may have a `notification_url` attribute (in case of PayPal and ComfortPay the attribute is mandatory), that will receive a ping on every change to a transaction (in case of PayPal or ComfortPay it is also the only way to find out the status of the payment).\n\nCheddar calls the value of `notification_url` attribute as POST request with GET attributes `uuid` and `signature` (which needs to be verified) and `application/json` body with full payment details as explained in the previous section.\n\nTo validate the signature, you need to call the following:\n\n```python\nis_valid = client.messages.validate(uuid, signature);\n```\n\nIn case the signature is incorrect a `cheddar.errors.MessageIntegrityError` is thrown, otherwise the function returns `true`. After a successful validation you can trust the json-encoded body of the request.\n\nThe JSON-encoded body will look something like this:\n\n```\n{\n \"uuid\": \"b1fcc76a-d284-4cbc-bce9-b415dc973763\",\n \"service\": {\n \"handle\": \"cardpay\",\n \"provider\": \"Tatra banka, a.s.\",\n \"name\": \"CardPay\"\n },\n \"status\": {\n \"status\": \"completed\",\n \"description\": \"The payment has been approved by the bank or financial institution\"\n },\n \"variable_symbol\": \"1000000000\",\n \"constant_symbol\": \"0308\",\n \"amount\": 9.99,\n \"refunded_amount\": 0,\n \"service_fee_amount\": 0,\n \"currency\": {\n \"alpha_code\": \"EUR\",\n \"numeric_code\": 978,\n \"name\": \"Euro\"\n },\n \"periodicity\": 0,\n \"periodicity_no\": 1,\n \"created_at\": \"2018-12-01 10:34:26\",\n \"events\": [],\n \"note\": \"my first test payment\",\n \"card_no\": \"****************\",\n \"transaction_identifier\": \"Aq83Lys6WHdiP8TFo6pnkRvTlpC=\"\n}\n```\n\n### Updating planned transaction\n\nThe next use case is the ability to change date and / or amount of a next planned periodical playment. The output of the call is summary of the planned payment including its UUID.\n\n```python\nimport datetime\n\npayment = client.payments.update(uuid, [\n \"charge_on\": datetime.date.today() + datetime.timedelta(days=1),\n \"amount\": Decimal('11.99')\n]);\n```\n\nHowever, also the status of the planned payment might be changed \u2013 from `none` to `cancelled` or the other way. Just make sure that the `charge_on` attribute is set to correct value or explicitly set it, when changing the status.\n\n### Refunding transactions\n\nWith Po\u0161tov\u00e1 banka\u2019s iTerminal service you might once request a refund on executed transaction in part, or in full. In case of Tatra banka's CardPay service you might request as many refunds as you'd like until sum of all prior refunds reaches the amount of the original transaction.\n\nThe `reason` is more informative and should be one of either `requested_by_customer`, `fraudelent`, `duplicate` or `unknown` (default). Currency has to be the same as when executing the original payment.\n\n```python\npayment = client.payments.refund(uuid, [\n \"amount\": Decimal(\"11.99\"),\n \"currency\": client.Currency.EUR,\n \"reason\": \"requested_by_customer\"\n]);\n```\n\n## Contributing\n\n1. Check for open issues or open a new issue for a feature request or a bug.\n2. Fork the repository and make your changes to the master branch (or branch off of it).\n3. Send a pull request.\n\n## Development\n\nRun all tests on all supported Python versions:\n\n\tmake test\n\nRun the linter with:\n\n\tmake lint\n\nThe client library uses Black for code formatting. Code must be formatted with Black before PRs are submitted. Run the formatter with:\n\n\tmake fmt\n\n\n---\n\n© 2019 BACKBONE, s.r.o.\n\n\n",
"description_content_type": "text/markdown",
"docs_url": null,
"download_url": "",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "https://www.backbone.sk/en/",
"keywords": "cheddar,api,payments,money,cardpay,comfortpay,tatrapay,trustpay,sporopay,eplatby,gpwebpay,iterminal",
"license": "MIT",
"maintainer": "",
"maintainer_email": "",
"name": "cheddarpayments",
"package_url": "https://pypi.org/project/cheddarpayments/",
"platform": "",
"project_url": "https://pypi.org/project/cheddarpayments/",
"project_urls": {
"Bug Tracker": "https://github.com/backbonesk/cheddar-python/issues",
"Homepage": "https://www.backbone.sk/en/",
"Source Code": "https://github.com/backbonesk/cheddar-python"
},
"release_url": "https://pypi.org/project/cheddarpayments/0.5.0/",
"requires_dist": [
"requests (>=2.21.0)",
"six (>=1.3.0)"
],
"requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
"summary": "Cheddar Python Bindings",
"version": "0.5.0"
},
"last_serial": 5882036,
"releases": {
"0.5.0": [
{
"comment_text": "",
"digests": {
"md5": "e168722f0b8d91d2948451bdcf56190f",
"sha256": "875c2d48ca5e9b48dc3fd8c9ffb1a0fbc7e7cc041d76b2b524ccac57f30537be"
},
"downloads": -1,
"filename": "cheddarpayments-0.5.0-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "e168722f0b8d91d2948451bdcf56190f",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
"size": 13943,
"upload_time": "2019-09-24T21:51:37",
"url": "https://files.pythonhosted.org/packages/7c/a9/d962d2ea8e00d467038d26015b619bf4e186b7021319ab79123a0dc48c42/cheddarpayments-0.5.0-py2.py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "aa7f6eb31052e07df53b2d181cb50bc1",
"sha256": "bfaa05f7a33b52971746e9bc25ea7134b9ba04fc8cdc225ef5e7c4efb2fd017a"
},
"downloads": -1,
"filename": "cheddarpayments-0.5.0.tar.gz",
"has_sig": false,
"md5_digest": "aa7f6eb31052e07df53b2d181cb50bc1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
"size": 17751,
"upload_time": "2019-09-24T21:51:41",
"url": "https://files.pythonhosted.org/packages/a7/c1/387269f98729a116a1c745c5fcae6b2e84467a960aef6ea3e34e6a564171/cheddarpayments-0.5.0.tar.gz"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "e168722f0b8d91d2948451bdcf56190f",
"sha256": "875c2d48ca5e9b48dc3fd8c9ffb1a0fbc7e7cc041d76b2b524ccac57f30537be"
},
"downloads": -1,
"filename": "cheddarpayments-0.5.0-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "e168722f0b8d91d2948451bdcf56190f",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
"size": 13943,
"upload_time": "2019-09-24T21:51:37",
"url": "https://files.pythonhosted.org/packages/7c/a9/d962d2ea8e00d467038d26015b619bf4e186b7021319ab79123a0dc48c42/cheddarpayments-0.5.0-py2.py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "aa7f6eb31052e07df53b2d181cb50bc1",
"sha256": "bfaa05f7a33b52971746e9bc25ea7134b9ba04fc8cdc225ef5e7c4efb2fd017a"
},
"downloads": -1,
"filename": "cheddarpayments-0.5.0.tar.gz",
"has_sig": false,
"md5_digest": "aa7f6eb31052e07df53b2d181cb50bc1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
"size": 17751,
"upload_time": "2019-09-24T21:51:41",
"url": "https://files.pythonhosted.org/packages/a7/c1/387269f98729a116a1c745c5fcae6b2e84467a960aef6ea3e34e6a564171/cheddarpayments-0.5.0.tar.gz"
}
]
}