Skip to main content

No project description provided

Project description

Yandex.Checkout Payout API Python Client Library

Build Status Latest Stable Version Total Downloads License

Russian | English

Client to work on Mass Payment Protocol

Opportunities

You can with this SDK:

  1. Generate a certificateп»ї for interaction with Yandex.Checkout.
  2. Transfer money to individuals for wallets in Yandex.Money, mobile phone numbers, Bank cards and accounts (makeDeposition).
  3. To test the possibility of transfer of remittances to wallets in Yandex.Money (testDeposition).
  4. Keep track of the balance of payments (balance).
  5. Receive notifications the unsuccessful status of transfers to a Bank account, card, or mobile phone (errorDepositionNotification).

Requirements

  • Python 3.5 (Рё выше)
  • pip

Installation

Under console using pip

  1. Install pip.
  2. In the console, run the following command:
pip install yandex_checkout_payout

Under console using easy_install

  1. Install easy_install.
  2. In the console, run the following command:
easy_install --upgrade yandex_checkout_payout

Manually

  1. In the console, run the following command:
wget https://github.com/yandex-money/yandex-checkout-payout-sdk-python/archive/master.zip
tar zxf yandex_checkout-master.tar.gz
cd yandex_checkout-master
python setup.py install

Getting a certificate for authenticating requests

To interact with Yandex.The cashier must obtain a certificate. For this:

  1. Create a private key and a certificate request (CSR).
  2. Fill out the certificate application form.
  3. Exchange data with Yandex.Money.

Step 1. Creating a private key and CSR

Using the SDK method

  1. Import classes to create CSR
from yandex_checkout_payout.domain.models.organization import Organization
from yandex_checkout_payout.payout import Payout
  1. Create an instance of the Organization class 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
})
  1. 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 console

  1. In the console, go to your project folder.
cd '<your project folder>'
  1. Execute the command:
ym-payout -getcsr
  1. Enter 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 application

Download the application to the certificate, fill it out and print it out. Sign and seal the document. Scan.

Parameter Description
CN Must match the value of the Common Name parameter (eg, YOUR name). For example, /business/predpriyatie.
Electronic signature of the certificate request The text view obtained in the previous step.
Organization name in Latin letters Must match the value of the Organization Name parameter (eg, company) Internet Widgits Pty Ltd.
The reason for the request Possible 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.Money

Send 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 server

Start of work

  1. Determine what types of payments you need and whether you want to check your balance.
  2. Import required classes
from yandex_checkout_payout.domain.common.keychain import KeyChain
from yandex_checkout_payout.configuration import Configuration
from yandex_checkout_payout.payout import Payout
  1. Import the classes you need to solve your problems.
  2. Create an instance of the KeyChain class 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')
  1. Create an instance of the Client class and pass the gateway ID from the merchant profile Yandex.Money and instance of the KeyChain class.
Configuration.configure('000000', keychain)
  1. Call the appropriate method. More information about making payments

Example of payment to a Bank account

# Importing classes
from yandex_checkout_payout.configuration import Configuration
from yandex_checkout_payout.payout import Payout
from yandex_checkout_payout.domain.common.keychain import KeyChain
from yandex_checkout_payout.domain.models.recipients.bank_account_recipient import BankAccountRecipient

# Creating a housekeeper and saving settings
keychain = KeyChain('./files/250000.cer', './files/privateKey.pem', '12345')
Configuration.configure(250000, keychain)

# Getting the current balance
balance = Payout.get_balance()

# The compilation of data on the beneficiary
recipient = BankAccountRecipient()
recipient.pof_offer_accepted = True
recipient.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 payout
request = MakeDepositionRequest()
request.agent_id = 250000
request.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 payment
result = Payout.create_deposition(request)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yandex-checkout-payout-1.0.1.tar.gz (32.8 kB view details)

Uploaded Source

File details

Details for the file yandex-checkout-payout-1.0.1.tar.gz.

File metadata

  • Download URL: yandex-checkout-payout-1.0.1.tar.gz
  • Upload date:
  • Size: 32.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for yandex-checkout-payout-1.0.1.tar.gz
Algorithm Hash digest
SHA256 707d99786a313a61a180d60a120c1dafe527d5afc4cca13d03c3d8fa2791a4b4
MD5 9c39a499e38a6e8e30ea6c299168b651
BLAKE2b-256 0a0291bd0367bb1ee0d2e2ebb18ccbd227a34b00051785735d3de6a187161155

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page