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. Get payment URL
    payment_url = await liqpay.get_payment_url(params)
    print(f"Payment URL: {payment_url}")
    
    # 3. 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).
  • get_payment_url(params): Asynchronously performs a POST request and returns the resulting payment URL.
  • 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.2.tar.gz (8.3 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.2-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: liqpay_api-0.1.2.tar.gz
  • Upload date:
  • Size: 8.3 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.2.tar.gz
Algorithm Hash digest
SHA256 16192254f733ccd403df13be64c25deafa02a5cb306c87b32e1bec66c747a3a5
MD5 1be1b4b25e2261dd6c0d2f8c84da120d
BLAKE2b-256 e744968b0bf22da6f51bf94f7fa20ef7d526a9c5d3b88f539dbcd04924db7bc1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: liqpay_api-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 7.2 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 25cce82e8b4749a8e1dcafcd0e183bb4e624860366150f2ce0b75a61e45e2684
MD5 372c52c800a3180d57d55909f69100fc
BLAKE2b-256 1f856accd71fd37ac7d97f9bac62edb9439eef1bc68f082469d73fbbc143cf87

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