Skip to main content

Asynchronous LiqPay SDK

Project description

About 📌

💸 LiqPayApi is a Python SDK for integrating with the LiqPay payment system. It provides functionality to generate payment forms or links, handle callbacks, and check order status, making it easy to integrate LiqPay payments into your applications.

Documentation 💡

Requirements ⚙️

  • Python 3.10+
  • aiohttp

Installation ☁️

pip install liqpay-api

Basic Example ⚡

import asyncio
from liqpay_api.client import LiqPayAsync

async def main():
    # Initialize the client
    liqpay = LiqPayAsync("your_public_key", "your_private_key")
    
    params = {
        "action": "pay",
        "amount": 100,
        "currency": "UAH",
        "description": "Payment for order #123",
        "order_id": "ORDER-123",
        "result_url": "https://your-site.com/success",
        "server_url": "https://your-site.com/liqpay-callback"
    }
    
    # 1. Generate direct checkout URL
    checkout_url = liqpay.generate_checkout_url(params)
    print(f"Checkout URL: {checkout_url}")
    
    # 2. Check payment status
    status = await liqpay.get_status("ORDER-123")
    print(f"Payment status: {status.get('status')}")

if __name__ == "__main__":
    asyncio.run(main())

Callback Handling 🔗

# Example of handling LiqPay callback (server-to-server)
data = "encoded_data_from_liqpay"
signature = "signature_from_liqpay"

try:
    decoded_params = liqpay.validate_callback(data, signature)
    if decoded_params.get("status") == "success":
        print(f"Order {decoded_params.get('order_id')} paid successfully!")
except ValueError:
    print("Invalid signature!")

Basic methods 🛠️

  • generate_checkout_url(params): Generates a direct payment link (GET request).
  • generate_cnb_form(params): Returns an HTML form with data and signature for manual redirection.
  • get_status(order_id): Asynchronously checks the status of a specific order.
  • pay(params): Convenience method for direct API payments (action="pay").
  • hold(params): Convenience method for fund blocking (action="hold").
  • subscribe(params): Convenience method for creating recurring payments.
  • validate_callback(data, signature): Decodes and verifies the signature of the incoming LiqPay server-to-server callback.
  • request(endpoint, params): Low-level method for any direct LiqPay API request.

Disclaimer 🔰

The information presented here is intended solely for educational and research purposes. It helps to better understand how systems work and how to apply secure practices in software development. 🔒

The author does not endorse or encourage the use of this information for illegal purposes 🚨

Use this knowledge responsibly and follow best practices in software development. 👀

Donation 💰

  • 📒 BTC: bc1qqxzd80fgzqyy4wjfqsweplfmw3av7hxp07eevx
  • 📘 ETH: 0x20be839c0b9d888e5DD153Cc55A4b93bb8496c48
  • 📗 USDT (TRC20): TY6SjeCBE4TRedVCbqk3XLqk5F4UMSGYqw

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

liqpay_api-0.1.1.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

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

liqpay_api-0.1.1-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file liqpay_api-0.1.1.tar.gz.

File metadata

  • Download URL: liqpay_api-0.1.1.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for liqpay_api-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9d579d229840d4ed952245298069c6126768cbad0698f40b10e240704728223e
MD5 f13a0970a1731406915bb5aedf996924
BLAKE2b-256 4aebbac21f0e824baedd45e5f2eb498b09941da643f8843c5611e98d210e076e

See more details on using hashes here.

File details

Details for the file liqpay_api-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: liqpay_api-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for liqpay_api-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4db1900fc9181469df746433c48712106139adfdce5f6a1f6b4ac2c4c857688c
MD5 b0e979058ab40f74210fb443b09a5f19
BLAKE2b-256 bc570eab4741c60cf59b31a7a5deb5674114a9eab1e4905ef00808dc41eafad5

See more details on using hashes here.

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