{ "info": { "author": "Ginger Payments", "author_email": "dev@gingerpayments.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "# Ginger Python bindings\n\n[![Build Status](https://travis-ci.org/gingerpayments/ginger-php.svg)](https://travis-ci.org/gingerpayments/ginger-python.svg)\n[![MIT License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://github.com/gingerpayments/ginger-php/blob/master/LICENSE)\n\n## Requirements\n\n* Python 3.6 or later\n* requests 2.20 or later\n\n## Installation\n\nYou can install the Python bindings from PyPI:\n\n```shell script\npip install ginger-sdk\n```\n\nYou can also use the Python bindings without using the Python Package Index by placing the ginger_sdk directory\nsomewhere in your `PYTHONPATH`.\n\n## Getting started\n\nFirst create a new API client with your API key and API endpoint:\n\n```python\nfrom ginger_sdk import Ginger\n\nclient = Ginger.create_client('https://api.example.com', 'your-api-key')\n```\n\n### Initiating a payment\n\nYou can start a new payment by creating a new order:\n\n```python\norder = client.create_order(\n {\n 'merchant_order_id': 'my-custom-order-id-12345',\n 'currency': 'EUR',\n 'amount': 2500, # Amount in cents\n 'description': 'Purchase order 12345',\n 'return_url': 'https://www.example.com',\n 'transactions': [\n {\n 'payment_method': 'credit-card',\n }\n ]\n }\n)\n```\n\nOnce you've created your order, a transaction is created and associated with it. You will need to redirect the user to\nthe transaction's payment URL, which you can retrieve as follows:\n\n```python\npayment_url = order['order_url']\n```\n\nIt is also recommended that you store the order's ID somewhere, so you can retrieve information about it later:\n\n```python\norder_id = order['id']\n```\n\nThere is a lot more data related to an order. Please refer to the API documentation provided by your PSP to learn more\nabout the various payment methods and options.\n\n### Getting an order\n\nIf you want to retrieve an existing order, use the `get_order` method on the client:\n\n```python\norder = client.get_order(order_id)\n```\n\nThis will return an associative array with all order information.\n\n### Updating an order\n\nSome fields are not read-only and you are able to update them after order has been created. You can do this using\nthe `update_order` method on the client:\n\n```python\norder = client.get_order(order_id)\norder['description'] = 'New Order Description'\nupdated_order = client.update_order(order)\n```\n\n### Initiating a refund\n\nYou can refund an existing order by using the `refund_order` method on the client:\n\n```python\nrefund_order = client.refund_order(order_id, {'amount': 123, 'description': 'My refund'})\n```\n\n### Capturing an order\n\nYou can initiate a capture of an order's transaction by using the `capture_order_transaction` method:\n\n```python\nclient.capture_order_transaction(order_id, transaction_id)\n```\n\n### Getting the iDEAL issuers\n\nWhen you create an order with the iDEAL payment method, you need to provide an issuer ID. The issuer ID is an identifier\nof the bank the user has selected. You can retrieve all possible issuers by using the `get_ideal_issuers` method:\n\n```python\nissuers = client.get_ideal_issuers()\n```\n\nYou can then use this information to present a list to the user of possible banks to choose from.\n\n### Custom requests\n\nYou can send any request that the API accepts using the `send` method. E.g. instead of using the `create_order` method\nyou could also use the following:\n\n```python\nresult = client.send(\n 'POST', # Request method\n '/orders/', # API path\n order_data # Data to send with the request; optional\n)\n```\n\nThe `$result` variable would then contain the decoded JSON returned by the API.\n\n## Using a different CA bundle\n\nIf you need to use a different CA bundle than the one that comes with your system, you can install the Certifi package\nfrom PyPI.\n\n```shell script\npip install certifi\n```\n\nThe certificates supplied by Certifi will be automatically used.\n\n## Custom HTTP client\n\nThis library ships with its own minimal HTTP client for compatibility reasons. If you would like to use a different HTTP\nclient, you can do so by extending the `ginger_sdk.http_client.HttpClient` abstract base class and then constructing\nyour own client:\n\n```python\nfrom ginger_sdk.api_client import ApiClient\n\nmy_http_client = MyHttpClient()\nclient = ApiClient(my_http_client)\n```\n\nMake sure your HTTP client prefixes the endpoint URL and API version to all requests, and uses HTTP basic auth to\nauthenticate with the API using your API key.\n\n## API documentation\n\nFor the complete API documentation please prefer to the resources provided by your PSP.", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/gingerpayments/ginger-python", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "ginger-sdk", "package_url": "https://pypi.org/project/ginger-sdk/", "platform": "", "project_url": "https://pypi.org/project/ginger-sdk/", "project_urls": { "Homepage": "https://github.com/gingerpayments/ginger-python" }, "release_url": "https://pypi.org/project/ginger-sdk/2.1.3/", "requires_dist": null, "requires_python": ">=3.6", "summary": "The official Ginger Payments Python SDK", "version": "2.1.3" }, "last_serial": 5919572, "releases": { "2.1.3": [ { "comment_text": "", "digests": { "md5": "ecffd967de8463a209014d654d9d9289", "sha256": "b04daaba52005d50cc9a7232a920f2b45a3a6b768cc36ea36cb86009fed47ab6" }, "downloads": -1, "filename": "ginger-sdk-2.1.3.tar.gz", "has_sig": false, "md5_digest": "ecffd967de8463a209014d654d9d9289", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 5163, "upload_time": "2019-10-02T19:00:15", "url": "https://files.pythonhosted.org/packages/03/3e/bf7626283e7f9654296e8c66d46696287bd8928a999d479be8d2374c891b/ginger-sdk-2.1.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ecffd967de8463a209014d654d9d9289", "sha256": "b04daaba52005d50cc9a7232a920f2b45a3a6b768cc36ea36cb86009fed47ab6" }, "downloads": -1, "filename": "ginger-sdk-2.1.3.tar.gz", "has_sig": false, "md5_digest": "ecffd967de8463a209014d654d9d9289", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 5163, "upload_time": "2019-10-02T19:00:15", "url": "https://files.pythonhosted.org/packages/03/3e/bf7626283e7f9654296e8c66d46696287bd8928a999d479be8d2374c891b/ginger-sdk-2.1.3.tar.gz" } ] }