Package: yandex-checkout-payout
Yandex.Checkout Payout API Python Client LibraryRussian| EnglishClient to work onMass Payment ProtocolOpportunitiesYou can with this SDK:Generate a certificateп»ї for interaction with Yandex.Checkout.Transfer moneyto individuals for wallets in Yandex.Money, mobile phone numbers, Bank cards and accounts (makeDeposition).To test the possibility of transfer of remittancesto wallets in Yandex.Money (testDeposition).Keep track of the balance of payments(balance).Receive notificationsthe unsuccessful status of transfers to a Bank account, card, or mobile phone (errorDepositionNotification).RequirementsPython 3.5 (Рё РІС‹С€Рµ)pipInstallationUnder console using pipInstall pip.In the console, run the following command:pipinstallyandex_checkout_payoutUnder console using easy_installInstall easy_install.In the console, run the following command:easy_install--upgradeyandex_checkout_payoutManuallyIn the console, run the following command:wgethttps://github.com/yandex-money/yandex-checkout-payout-sdk-python/archive/master.zip
tarzxfyandex_checkout-master.tar.gzcdyandex_checkout-master
pythonsetup.pyinstallGetting a certificate for authenticating requestsTo interact with Yandex.The cashier must obtain a certificate. For this:Create a private key and a certificate request (CSR).Fill out the certificate application form.Exchange data with Yandex.Money.Step 1. Creating a private key and CSRUsing the SDK methodImport classes to create CSRfromyandex_checkout_payout.domain.models.organizationimportOrganizationfromyandex_checkout_payout.payoutimportPayoutCreate an instance of theOrganizationclass with data for creating the request. All data must be entered in Latin.org=Organization({"org_name":"Yandex Money",# Organization Name (Latin)"common_name":"/business/yandexmoney",# Common Name, for example the name of your organization; must start with В«/business/В»"email":"cms@yamoney.ru"# Email})Create a CSR and a private key.# Specify the location where the files should be saved and the password for the private key (if necessary)Payout.get_csr(org,'./files/output','12345')As a result, the SDK will generate a private key, CSR, and a text file with an electronic signature (necessary for further steps).Via the consoleIn the console, go to your project folder.cd'<your project folder>'Execute the command:ym-payout -getcsrEnter data for the certificate, following the instructions on the screen. The text must be entered in Latin letters.
As a result, the SDK will generate a private key, CSR, and a text file with an electronic signature (necessary for further steps).Step 2. Filling out the certificate applicationDownload the applicationto the certificate, fill it out and print it out. Sign and seal the document. Scan.ParameterDescriptionCNMust match the value of the Common Name parameter (eg, YOUR name). For example,/business/predpriyatie.Electronic signature of the certificate requestThe text view obtained in the previous step.Organization name in Latin lettersMust match the value of the Organization Name parameter (eg, company)Internet Widgits Pty Ltd.The reason for the requestPossible options:initialвЂ” to get the first certificate;scheduled replacementвЂ” to replace a certificate that has expired;replacement of a compromisedвЂ” to replace a previously issued certificate in the event of a security breach;adding a serverвЂ” to use the new certificate on additional servers or services.Contact person (full name, phone number, e-mail)Contact a specialist to contact you if you have any questions about the issued certificate.Step 3. Data exchange with Yandex.MoneySend the certificate request file (request.csr) and a scan of the request by email to your Yandex Manager.Box office.
In response to the request, the Manager will send a file with the certificate within 2 business days. The certificate is valid for 1 year.
Place the received certificate on your serverStart of workDetermine what types of payments you need and whether you want to check your balance.Import required classesfromyandex_checkout_payout.domain.common.keychainimportKeyChainfromyandex_checkout_payout.configurationimportConfigurationfromyandex_checkout_payout.payoutimportPayoutImport the classes you need to solve your problems.Create an instance of theKeyChainclass by passing the path to the public key, the path to the private key, and, if necessary, the password for the private key.keychain=KeyChain('publicCert.cer','privateCert.pem','password')Create an instance of theClientclass and pass the gateway ID from themerchant profileYandex.Money and instance of theKeyChainclass.Configuration.configure('000000',keychain)Call the appropriate method.More information about making paymentsExample of payment to a Bank account# Importing classesfromyandex_checkout_payout.configurationimportConfigurationfromyandex_checkout_payout.payoutimportPayoutfromyandex_checkout_payout.domain.common.keychainimportKeyChainfromyandex_checkout_payout.domain.models.recipients.bank_account_recipientimportBankAccountRecipient# Creating a housekeeper and saving settingskeychain=KeyChain('./files/250000.cer','./files/privateKey.pem','12345')Configuration.configure(250000,keychain)# Getting the current balancebalance=Payout.get_balance()# The compilation of data on the beneficiaryrecipient=BankAccountRecipient()recipient.pof_offer_accepted=Truerecipient.bank_name='Barclays'recipient.bank_city='London'recipient.bank_cor_account='30101810400000000225'recipient.customer_account='40817810255030943620'recipient.bank_bik='042809679'recipient.payment_purpose='Refund under the agreement 25-001, without VAT'recipient.pdr_first_name='John'recipient.pdr_last_name='Watson'recipient.pdr_doc_number='4002109067'recipient.pdr_doc_issue_date='1999-07-30'recipient.pdr_address='Baker street, 221'recipient.pdr_birth_date='1987-05-24'recipient.sms_phone_number='79653457676'# Preparing a request to create a payoutrequest=MakeDepositionRequest()request.agent_id=250000request.client_order_id='215d8da0-000f-50be-b000-0003308c89be'request.request_dt='2020-03-04T15:39:45.456+03:00'request.payment_params=recipient# The carrying out of the paymentresult=Payout.create_deposition(request)