liqpy


Nameliqpy JSON
Version 0.14.1 PyPI version JSON
download
home_page
SummaryUnofficial Python libary for LiqPay API
upload_time2024-03-05 16:29:07
maintainer
docs_urlNone
author
requires_python>=3.11
licenseMIT License Copyright (c) 2024 Rostyslav Bohomaz Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords api liqpay
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # LiqPy

LiqPy -- unofficial python library for [LiqPay API](https://www.liqpay.ua/documentation/api/home).

> _Is it **production ready**?_
>
> Short answer: Well, yes, but actually no.
> 
> Long answer: It depends on what production readiness means for you.
> Implementation still lacks some LiqPay's functionality and tests coverage,
> but I, personally, use it in production.
> It gets work done in a most pythonic way I see it.

## Installation

```shell
pip install liqpy
```

## Basic Usage

Create checkout link:

```python
from liqpy.client import Client

client = Client(public_key=..., private_key=...)

client.checkout(
    action="pay",
    order_id=...,
    amount=1,
    currency="USD",
    description="Payment Example",
    server_url=...
)
```

Handle [callback from LiqPay](https://www.liqpay.ua/en/documentation/api/callback) after checkout on your server (`server_url`):

```python
def handle_callback(data: str, signature: str):
    try:
        callback = client.callback(data, signature)
        print(callback)
    except AssertionError as e:
        print("LiqPay callback verification failed.", e)
```


## Development

Create Python environment (optional):

```shell
python -m env env
```

Install requirements:

```shell
pip install -r requirements.txt -r requirements-dev.txt
```


### Setup credentials

Get your `public_key` and `private_key` from LiqPay.

Write keys to `.env` file as follows:

```shell
LIQPAY_PUBLIC_KEY=${public_key}
LIQPAY_PRIVATE_KEY=${private_key}
```


### Local webhook handler

Bind localhost port to the Internet:

```shell
ngrok http 8000
```

Look for the similar line in console:

```
Forwarding https://7kh6-111-111-111-111.ngrok-free.app -> http://localhost:8000 
```

Add server URL to `.env` file:

```
SERVER_URL=https://7kh6-111-111-111-111.ngrok-free.app
```

Start local webhook handler:

```shell
python -m tests.server
```

Now you can recieve callbacks after requesting LiqPay API.

```python
from os import environ
from dotenv import load_env
from liqpay.client import Client

client = Client()

client.request(
    action=...,
    order_id=...,
    amount=...,
    server_url=environ.get("SERVER_URL")
)
```

See [`readme.ipynb`](./readme.ipynb) for more examples.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "liqpy",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": "",
    "keywords": "api,liqpay",
    "author": "",
    "author_email": "Rostyslav Bohomaz <rostyslav.db@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/73/e7/ab1b0736ecd4b961f13516c01b34b4f39c4e9d6a2295c54eba4e23fad474/liqpy-0.14.1.tar.gz",
    "platform": null,
    "description": "# LiqPy\n\nLiqPy -- unofficial python library for [LiqPay API](https://www.liqpay.ua/documentation/api/home).\n\n> _Is it **production ready**?_\n>\n> Short answer: Well, yes, but actually no.\n> \n> Long answer: It depends on what production readiness means for you.\n> Implementation still lacks some LiqPay's functionality and tests coverage,\n> but I, personally, use it in production.\n> It gets work done in a most pythonic way I see it.\n\n## Installation\n\n```shell\npip install liqpy\n```\n\n## Basic Usage\n\nCreate checkout link:\n\n```python\nfrom liqpy.client import Client\n\nclient = Client(public_key=..., private_key=...)\n\nclient.checkout(\n    action=\"pay\",\n    order_id=...,\n    amount=1,\n    currency=\"USD\",\n    description=\"Payment Example\",\n    server_url=...\n)\n```\n\nHandle [callback from LiqPay](https://www.liqpay.ua/en/documentation/api/callback) after checkout on your server (`server_url`):\n\n```python\ndef handle_callback(data: str, signature: str):\n    try:\n        callback = client.callback(data, signature)\n        print(callback)\n    except AssertionError as e:\n        print(\"LiqPay callback verification failed.\", e)\n```\n\n\n## Development\n\nCreate Python environment (optional):\n\n```shell\npython -m env env\n```\n\nInstall requirements:\n\n```shell\npip install -r requirements.txt -r requirements-dev.txt\n```\n\n\n### Setup credentials\n\nGet your `public_key` and `private_key` from LiqPay.\n\nWrite keys to `.env` file as follows:\n\n```shell\nLIQPAY_PUBLIC_KEY=${public_key}\nLIQPAY_PRIVATE_KEY=${private_key}\n```\n\n\n### Local webhook handler\n\nBind localhost port to the Internet:\n\n```shell\nngrok http 8000\n```\n\nLook for the similar line in console:\n\n```\nForwarding https://7kh6-111-111-111-111.ngrok-free.app -> http://localhost:8000 \n```\n\nAdd server URL to `.env` file:\n\n```\nSERVER_URL=https://7kh6-111-111-111-111.ngrok-free.app\n```\n\nStart local webhook handler:\n\n```shell\npython -m tests.server\n```\n\nNow you can recieve callbacks after requesting LiqPay API.\n\n```python\nfrom os import environ\nfrom dotenv import load_env\nfrom liqpay.client import Client\n\nclient = Client()\n\nclient.request(\n    action=...,\n    order_id=...,\n    amount=...,\n    server_url=environ.get(\"SERVER_URL\")\n)\n```\n\nSee [`readme.ipynb`](./readme.ipynb) for more examples.\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 Rostyslav Bohomaz  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "Unofficial Python libary for LiqPay API",
    "version": "0.14.1",
    "project_urls": {
        "Repository": "https://github.com/rostyq/liqpy"
    },
    "split_keywords": [
        "api",
        "liqpay"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e14773d1c84865c152f8c05bb748b911f26407e361b97c335b98eac57a83726d",
                "md5": "3d9cc4b3313b6d6413ae0e06bce5dafd",
                "sha256": "fb2e1de95106533eb5ee29ef86f7fe911a9f8bfb86e012e9dac683ff69be7a3d"
            },
            "downloads": -1,
            "filename": "liqpy-0.14.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3d9cc4b3313b6d6413ae0e06bce5dafd",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 29788,
            "upload_time": "2024-03-05T16:29:06",
            "upload_time_iso_8601": "2024-03-05T16:29:06.087689Z",
            "url": "https://files.pythonhosted.org/packages/e1/47/73d1c84865c152f8c05bb748b911f26407e361b97c335b98eac57a83726d/liqpy-0.14.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "73e7ab1b0736ecd4b961f13516c01b34b4f39c4e9d6a2295c54eba4e23fad474",
                "md5": "fb2abe7ac54508c99d3c34d9794dc14e",
                "sha256": "17807b0809406a1a44de0c5cb0b0be9d165fbb0a3dd78848475a552a11ee3c43"
            },
            "downloads": -1,
            "filename": "liqpy-0.14.1.tar.gz",
            "has_sig": false,
            "md5_digest": "fb2abe7ac54508c99d3c34d9794dc14e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 25975,
            "upload_time": "2024-03-05T16:29:07",
            "upload_time_iso_8601": "2024-03-05T16:29:07.775523Z",
            "url": "https://files.pythonhosted.org/packages/73/e7/ab1b0736ecd4b961f13516c01b34b4f39c4e9d6a2295c54eba4e23fad474/liqpy-0.14.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-05 16:29:07",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "rostyq",
    "github_project": "liqpy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "liqpy"
}
        
Elapsed time: 0.58324s