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.0.tar.gz (6.2 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.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: liqpay_api-0.1.0.tar.gz
  • Upload date:
  • Size: 6.2 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.0.tar.gz
Algorithm Hash digest
SHA256 87cdc64508abe592c41b6d282a5a0f1580f9a8b770ac82acceae235f7c2885f4
MD5 3dc352d9227401dc19cf6a05d580e4ec
BLAKE2b-256 da58c3a69fcc8479ff8b8e81469be77eaf7e846c3469ede2c775240fa18fd1cf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: liqpay_api-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.1 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a2d4463c69ae2f2344a6d001820f94bacafca17bdc34dbad96d49e377afe2664
MD5 17618bb4bed688be9e26c3bd18b6a060
BLAKE2b-256 7acaadf02e67e363689aae209f516838ff28335637d3126a8266fc0b7d7b9b3a

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