Package: neoliqpay
neoliqpayVersion: 3.0.0Web:https://www.liqpay.ua/Download:https://pypi.org/project/neoliqpaySource:https://github.com/MiloLug/neoliqpayDocumentation:https://www.liqpay.ua/documentation/en/Keywords: neoliqpay, aioliqpay, liqpay, privat24, privatbank, python, internet acquiring, P2P payments, two-step payments, asyncioWhat python version is supported?Python 3.6, 3.7, 3.8, 3.9, 3.10Get StartedSign up inhttps://www.liqpay.ua/en/authorization.Create a company.In company settings, on API tab, getPublic keyandPrivate key.Done.InstallationWith pip:pipinstallneoliqpay[sync]# for sync variantpipinstallneoliqpay[async]# for async variantpipinstallneoliqpay[async,sync]# for bothWorking with LiqPay Callback locallyIf you need debugging API Callback on local environment usehttps://github.com/inconshreveable/ngrokUsingExample 1: BasicBackendGet 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=<decodeddata>&signature=<decodedsignature>FrontendVariablehtmlwill contain next html form<formmethod="POST"action="https://www.liqpay.ua/api/3/checkout"accept-charset="utf-8"><inputtype="hidden"name="data"value="eyAidmVyc2lvbiIgOiAzLCAicHVibGljX2tleSIgOiAieW91cl9wdWJsaWNfa2V5IiwgImFjdGlvbiIgOiAicGF5IiwgImFtb3VudCIgOiAxLCAiY3VycmVuY3kiIDogIlVTRCIsICJkZXNjcmlwdGlvbiIgOiAiZGVzY3JpcHRpb24gdGV4dCIsICJvcmRlcl9pZCIgOiAib3JkZXJfaWRfMSIgfQ=="/><inputtype="hidden"name="signature"value="QvJD5u9Fg55PCx/Hdz6lzWtYwcI="/><inputtype="image"src="//static.liqpay.ua/buttons/p1ru.radius.png"/></form>Example 2: Integrate Payment widget with DjangoPayment widget documentationhttps://www.liqpay.ua/documentation/en/api/aquiring/widget/Backendviews.pyfromneoliqpayimportLiqPayfromdjango.views.genericimportTemplateViewfromdjango.shortcutsimportrenderfromdjango.httpimportHttpResponseliqpay=LiqPay(settings.LIQPAY_PUBLIC_KEY,settings.LIQPAY_PRIVATE_KEY)classPayView(TemplateView):template_name='billing/pay.html'defget(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)returnrender(request,self.template_name,{'signature':signature,'data':data})classPayCallbackView(View):defpost(self,request,*args,**kwargs):data=request.POST.get('data')signature=request.POST.get('signature')ifliqpay.callback_is_valid(signature,data):print('callback is valid')response=liqpay.decode_data(data)print('callback data',response)returnHttpResponse()urls.pyfromdjango.conf.urlsimportpathfrombilling.viewsimportPayView,PayCallbackViewurlpatterns=[path('pay/',PayView.as_view(),name='pay_view'),path('pay-callback/',PayCallbackView.as_view(),name='pay_callback'),]billing/pay.html<divid="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><scriptsrc="//static.liqpay.ua/libjs/checkout.js"async></script>