Package: client-payment-sdk
Client payment SDK PythonRussian| EnglishClient payment SDK provides convenient access to theAPIfrom applications written in the Python language. It includes a pre-defined set of classes for API resources that initialize themselves dynamically from API responses.InstallationviapipInstall pip.In the console, run the following command:pipinstallclient-payment-sdkviaeasy_installInstall easy_install.In the console, run the following command:easy_install--upgradeclient-payment-sdkviasetuptoolsIn the console, run the following command:wgethttps://github.com/Space-Around/client-payment-sdk-python/archive/refs/heads/main.zip
tarzxfclient-payment-sdk-python-main.tar.gzcdclient-payment-sdk-python-main
pythonsetup.pyinstallRequirementsPython 3.10+Usagefromclient_payment_sdkimportClientPaymentSDK,signclient=ClientPaymentSDK()DocumentationSeeAPI docs.All exampleshere..init()Description:Payment initiation.ArgumentsNameDescriptionExampleRequiredamountpayment amount10+orderorder number in your systemorder-00001+merchant_idyour id in the system1+product_idproduct id in the system1+to_cardpayment card number4111111111111111-signaturesignaturequahJ5th...+descriptionorder descriptionOrdering a product-languagelanguage: ru or enen-finish_urlurl to which to redirect the user after paymenthttps://exemple.com-2notification_urlurl to which to send a notification of paymenthttps://exemple.com-lifetimelink time in seconds (default 3600)3600-host2hostArgumentsNameDescriptionExampleRequiredpancard number4111111111111111+expire_monthcard expiry date (month)01+expire_yearcard expiry date (year)25+cvccvc-code1+3DS 2.0ArgumentsNameDescriptionExampleRequireddevice_channelauthentication channelBRW+device_browser_ipbrowser IP address0.0.0.0+device_browser_accept_headeraccepted contenttext/html+device_browser_java_enabledindication of work with Javafalse+device_browser_languagebrowser languageRU+device_browser_color_depthbrowser colour depth32+device_browser_screen_heightbrowser screen height800+device_browser_screen_widthbrowser screen width480+device_browser_tzbrowser time zone in minutes from UTC60, 120, -180+device_browser_user_agentbrowser user agentMozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0+challenge_window_sizesize of challenge window02+Return:InitPaymentResponseField nameDefaultstatusNonepayment_redirect_urlNoneurlNoneform_dataNoneExample:result=client.init(params).status()Description:Get payment status.ArgumentsNameDescriptionExampleRequiredmerchant_idyour id in the system1+product_idproduct id in the system1+orderyour id in the systemorder-00001+signaturesignaturequahJ5th...+Return:StatusPaymentResponseField nameDefaultstatusNonepayment_statusNonerefund_statusNonelast_payment_error_codeNonelast_payment_errorNoneExample:result=client.status(params).balace()Description:Get balance.ArgumentsNameDescriptionExampleRequiredmerchant_idyour id in the system1+currencyaccount currency (RUB by default)RUB-signaturesignaturequahJ5th...+Return:BalanceResponseField nameDefaultstatusNonebalanceNoneExample:result=client.balance(params).withdrawal()Description:Withdrawal request.ArgumentsNameDescriptionExampleRequiredmerchant_idyour id in the system1+orderorder number in your systemorder-00001+currencyaccount currency (RUB by default)RUB-pancard number4242424242424242+amountpayment amount10+signaturesignaturequahJ5th...+notification_urlurl to which to send a notification of paymenthttps://exemple.com-Return:WithdrawalResponseField nameDefaultstatusNonewithdrawal_requestNoneExample:result=client.withdrawal(params).withdrawal_status()Description:Withdrawal status.ArgumentsNameDescriptionExampleRequiredmerchant_idyour id in the system1+idwithdrawal request id1523+signaturesignaturequahJ5th...+orNameDescriptionExampleRequiredmerchant_idyour id in the system1+orderwithdrawal number in your systemorder-00001+signaturesignaturequahJ5th...+Return:StatusWithdrawalResponseField nameDefaultstatusNonewithdrawal_requestNoneExample:result=client.withdrawal_status(params)Webhook.verify_signature()Description:Signature verification.ArgumentsNameDescriptionExampleRequiredendpointpath from url/webhooks+methodHTTP methodPOST+paramspayload from responseWebhookData(data_from_response)+secretsecret1234fwes+Return:Trueor raise errorSignatureVerificationError.Example:data=WebhookData(data_from_response)Webhook.verify_signature('/webhooks','POST',data,api_secret)WebhookData()Description:Notification class, is needed for theWebhook.verify_signature()method and to more easily get data from the request.Arguments:dictReturn:WebhookDataNameDescriptionExamplewebhook_typewebhook typeinvoiceamountpayment amountamountproduct_idproduct id in the system1merchant_idyour id in the system1orderorder number in your systemorder-00001currencypayment currencyRUBstatuspayment status complete/failedcompletewebhook_idwebhook id, same on repetition1payment_error_codeerror code (if status='failed')commonpayment_errorerror text (if status='failed')insufficient fundssignaturesignaturequahJ5th...withdrawal_request_idtransaction id in the system1requested_amountamount requested for withdrawal100invoice_idtransaction id in the system1customer_feecommission to be deducted from the purchaser2masked_panmasked beneficiary card numberRUBExample:# using Flask@app.route("/webhooks",methods=["POST"])defwebhooks():payload=request.form.to_dict()try:data=WebhookData(payload)print(Webhook.verify_signature('/webhooks','POST',data,api_secret))# usage dataexceptValueError:print("Error while decoding event!")return"Bad payload",400exceptSignatureVerificationError:print("Invalid signature!")return"Bad signature",400return"",200.sign()Description:Create jws signatureArgumentsNameDescriptionExampleRequiredendpointpath from url/init+methodHTTP methodPOST+paramspayload (dict){}+secretsecret1234fwes+Return:strExample:api_secret='aa21444f3f71'payload={'amount':10,'merchant_id':15,'order':'241eeda4-7491-11ec-9c7f-0242ac130021','product_id':15,'notification_url':'http://25ab-91-241-13-31.ngrok.io/webhooks'}payload['signature']=sign('/init','POST',payload,api_secret)LicenseThis project is licensed under theMIT license.