Skip to main content

Python 3.6+

SDK-Python3

What python version is supported?

  • Python 3.4+

Get Started

  1. Sign up in https://www.liqpay.ua/en/authorization.
  2. Create a company.
  3. In company settings, on API tab, get Public key and Private key: https://www.liqpay.ua/doc
  4. Done.

Installation

From pip pip install liqpay-async

Working with LiqPay Callback locally

If you need debugging API Callback on local environment use https://localtunnel.github.io/www/

How it uses?

Example 1: Pin token card to user

Backend Get url on SDK

Request url: https://www.liqpay.ua/api/3/checkout

from liqpay_async import LiqPay

liqpay_manager = LiqPay(public_key, private_key)
response = await liqpay_manager.post( 
        return_url=True,
        data={
            "action": "hold",
            "version": "3",
            "amount": "1",
            "currency": "UAH",  # or any currency
            "description": "Pin card",
            "language": "uk|en"     # liqpay have only ("uk", "en)
            "order_id": f"{id_user from token} {str(uuid.uuid4())}",    # id_user from token need for pin card to user
            "server_url": f"{YOUR_HOST}{URL}",  # for callback response
            "recurringbytoken": "1",    # for get token in response callback
        },
    )
    
    # check on bad response
    if response["status"] in (0, 1):
        # when response status 0 or 1 from response dict u can get key 'err_code' - https://www.liqpay.ua/doc/api/errors
        raise
    
# OK response - {"url: url, status: STATUS_MAPPING}
# return url on SDK

# When u sent card credentials in checkout SDK LiqPay. U get response on the url(server_url) from request dict
#Example:

from fastapi import Request, Body

LIQPAY_DOMAIN = "liq_pay domain"

async def pin_card(
        request: Request,
        liq_pay: YourModel = Body(...),
):
    origin = request.headers.get("origin")
    if not origin or origin != LIQPAY_DOMAIN:   # for security
        raise 
    
    data = liq_pay.order_id.split()

    await liqpay_manager.post(
                data={
                    "action": "refund",     # refund money
                    "version": "3",
                    "order_id": liq_pay.order_id,
                }
            )

    # and save data from callback

    # data[0] - its id user from order_id
    # card_token, sender_card_mask2, sender_card_type

Example 2: For other operation by token card

Backend

Request url: https://www.liqpay.ua/api/request

from liqpay_async import LiqPay

liqpay_manager = LiqPay(public_key, private_key)

# https://www.liqpay.ua/doc/api/internet_acquiring/checkout?tab=1
response = await liqpay_manager.post( 
        data={
            "action": "your action",
            "version": "3",
            "amount": "1",
            "currency": "UAH",  # or any currency
            "description": "Your desc",
            "language": "uk|en"     # liqpay have only ("uk", "en)
            "order_id": "str(uuid.uuid4())",
            "card_token": your_card_token
        },
    )
    
# OK response - {status: STATUS_MAPPING and others)

Example 3: Errors

Backend

# if response aiothhp error -> response {"status": 0}

Metadata

Release files for liqpay-async 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for liqpay-async 0.0.1
File Size Uploaded Provenance
liqpay-async-0.0.1.tar.gz 3.4 kB Without provenance Details

Release files / liqpay-async-0.0.1.tar.gz

Download URL liqpay-async-0.0.1.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
85dada930ce3ad26a45f43e9fa2fd1b2d3bf7e84feb4641dbe7948f1e8306081
BLAKE2b-256 checksum
How to use checksums
651f533a8ffc4763e718e679cd93356b9ad79e200f79ed6763e194cda4871f93
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.8

Security for liqpay-async 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page