Skip to main content

neoliqpay

Python 3.6+

SDK-Python3

What python version is supported?

  • Python 3.6, 3.7, 3.8, 3.9, 3.10

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.
  4. Done.

Installation

With pip:

pip install neoliqpay[sync]   # for sync variant

pip install neoliqpay[async]  # for async variant

pip install neoliqpay[async,sync]  # for both

Working with LiqPay Callback locally

If you need debugging API Callback on local environment use https://github.com/inconshreveable/ngrok

Using

Example 1: Basic

Backend

Get payment button (html response)

liqpay = LiqPay(public_key, private_key)
html = liqpay.cnb_form(
    action='pay',
    amount=1,
    currency='UAH',
    description='description text',
    order_id='order_id_1',
    language='ua'
)

Get plain checkout url:

liqpay = LiqPay(public_key, private_key)
html = liqpay.checkout_url({
    action='auth',
    amount=1,
    currency='UAH',
    description='description text',
    order_id='order_id_1',
    language='ua',
    recurringbytoken=1'
})
# Response:

str: https://www.liqpay.ua/api/3/checkout/?data=<decoded data>&signature=<decoded signature>

Frontend

Variable html will contain next html form

    <form method="POST" action="https://www.liqpay.ua/api/3/checkout" accept-charset="utf-8">
        <input type="hidden" name="data" value="eyAidmVyc2lvbiIgOiAzLCAicHVibGljX2tleSIgOiAieW91cl9wdWJsaWNfa2V5IiwgImFjdGlv
        biIgOiAicGF5IiwgImFtb3VudCIgOiAxLCAiY3VycmVuY3kiIDogIlVTRCIsICJkZXNjcmlwdGlv
        biIgOiAiZGVzY3JpcHRpb24gdGV4dCIsICJvcmRlcl9pZCIgOiAib3JkZXJfaWRfMSIgfQ=="/>
        <input type="hidden" name="signature" value="QvJD5u9Fg55PCx/Hdz6lzWtYwcI="/>
        <input type="image"
        src="//static.liqpay.ua/buttons/p1ru.radius.png"/>
    </form>

Example 2: Integrate Payment widget with Django

Payment widget documentation https://www.liqpay.ua/documentation/en/api/aquiring/widget/

Backend

views.py

    from neoliqpay import LiqPay

    from django.views.generic import TemplateView
    from django.shortcuts import render
    from django.http import HttpResponse


    liqpay = LiqPay(settings.LIQPAY_PUBLIC_KEY, settings.LIQPAY_PRIVATE_KEY)


    class PayView(TemplateView):
        template_name = 'billing/pay.html'

        def get(self, request, *args, **kwargs):
            params = {
                'action': 'pay',
                'amount': 100,
                'currency': 'USD',
                'description': 'Payment for clothes',
                'order_id': 'order_id_1',
                'server_url': 'https://test.com/billing/pay-callback/', # url to callback view
            }
            signature, data = liqpay.cnb_signature_data_pair(params)
            
            return render(
                request,
                self.template_name,
                {
                    'signature': signature,
                    'data': data
                }
            )


    class PayCallbackView(View):
        def post(self, request, *args, **kwargs):
            data = request.POST.get('data')
            signature = request.POST.get('signature')

            if liqpay.callback_is_valid(signature, data):
                print('callback is valid')

            response = liqpay.decode_data(data)
            print('callback data', response)
            return HttpResponse()

urls.py

    from django.conf.urls import path

    from billing.views import PayView, PayCallbackView


    urlpatterns = [
        path('pay/', PayView.as_view(), name='pay_view'),
        path('pay-callback/', PayCallbackView.as_view(), name='pay_callback'),
    ]

billing/pay.html

    <div id="liqpay_checkout"></div>
    <script>
        window.LiqPayCheckoutCallback = function() {
            LiqPayCheckout.init({
                data: "{{ data }}",
                signature: "{{ signature }}",
                embedTo: "#liqpay_checkout",
                mode: "embed" // embed || popup,
            }).on("liqpay.callback", function(data){
                console.log(data.status);
                console.log(data);
            }).on("liqpay.ready", function(data){
                // ready
            }).on("liqpay.close", function(data){
                // close
            });
        };
    </script>
    <script src="//static.liqpay.ua/libjs/checkout.js" async></script>

Metadata

Release files for neoliqpay 3.0.0

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

Source distribution (sdist)

Source distribution for neoliqpay 3.0.0
File Size Uploaded Provenance Actions
neoliqpay-3.0.0.tar.gz 7.5 kB Without provenance Details for neoliqpay-3.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for neoliqpay 3.0.0
File Interpreter ABI Platform Actions
neoliqpay-3.0.0-py3-none-any.whl Python 3 none any Details for neoliqpay-3.0.0-py3-none-any.whl

Total release size: 15.6 kB

Release files / neoliqpay-3.0.0.tar.gz

Download URL neoliqpay-3.0.0.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4bd41067f190e165ffda6b99409d07d6d23a50ceb8ed9ded721f7b333259afcd
BLAKE2b-256 checksum
How to use checksums
efa07298354ae2c32b645affa60606fbbcce12e34c960cb889d24b2e723ccb51
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.5

Release files / neoliqpay-3.0.0-py3-none-any.whl

Download URL neoliqpay-3.0.0-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5b85a81ef448d0575f264a2b0131ef38cdb69d1eb58c68c2356cb90469af4db9
BLAKE2b-256 checksum
How to use checksums
4a22ea590c76cc7935c84a9c91065c5a282ab621c21c817f21f885e68e3676bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.5

Security for neoliqpay 3.0.0

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.

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