Skip to main content

Unofficial Python libary for LiqPay API

Project description

LiqPy

LiqPy -- unofficial python library for LiqPay API.

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

pip install liqpy

Basic Usage

Get public_key and private_key from LiqPay and create a checkout link:

from liqpy.client import Client

# env variables for keys are LIQPAY_PUBLIC_KEY and LIQPAY_PRIVATE_KEY
client = Client(public_key=..., private_key=...)

checkout_link = client.checkout(
    action="pay",
    order_id=...,
    amount=1,
    currency="USD",
    description="Payment Example",
    # set server_url for handling a callback
    # server_url=...
)
print(checkout_link)

Handle Callback

Handle callback from LiqPay after checkout on your server (server_url):

from urllib.parse import parse_qs
from liqpy.api.exceptions import LiqPayRequestException

# request body content type is application/x-www-form-urlencoded
def handle_callback(body: str):
    query = parse_qs(body)
    data, signature = query["data"][0], query["signature"][0]
    try:
        result = client.callback(data, signature)
        print(result)
    except LiqPayRequestException:
        print("LiqPay callback verification failed.")

See readme.ipynb for more examples.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

liqpy-0.20.0.tar.gz (73.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

liqpy-0.20.0-py3-none-any.whl (34.2 kB view details)

Uploaded Python 3

File details

Details for the file liqpy-0.20.0.tar.gz.

File metadata

  • Download URL: liqpy-0.20.0.tar.gz
  • Upload date:
  • Size: 73.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for liqpy-0.20.0.tar.gz
Algorithm Hash digest
SHA256 d7d9e6e7d4e86b615aad525742c7e0c5d069ced19b23ae54a995f4f91184a85a
MD5 ee2ca4f4e911896c3bd77ea1ca7b0eb0
BLAKE2b-256 4e49c4ca9ebed0ac7477f161135a3eca289da3cedda24c0e6b2c2433abf7e855

See more details on using hashes here.

Provenance

The following attestation bundles were made for liqpy-0.20.0.tar.gz:

Publisher: publish.yml on rostyq/liqpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file liqpy-0.20.0-py3-none-any.whl.

File metadata

  • Download URL: liqpy-0.20.0-py3-none-any.whl
  • Upload date:
  • Size: 34.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for liqpy-0.20.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1f928e6fd903a8049688bfda74a4dbf944608597e222c7baca948f304667e84f
MD5 75334c7c75791d59b5d88511b7b9eb59
BLAKE2b-256 4cadae94ca620f5c364e79f3802ef67fc2e0b0265c3107cfb7543f67df1240fb

See more details on using hashes here.

Provenance

The following attestation bundles were made for liqpy-0.20.0-py3-none-any.whl:

Publisher: publish.yml on rostyq/liqpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page