yookassa-payout


Nameyookassa-payout JSON
Version 2.5.2 PyPI version JSON
download
home_pagehttps://git.yoomoney.ru/projects/SDK/repos/yookassa-payout-sdk-python
SummaryYooKassa Payout API SDK Python Library
upload_time2023-09-27 08:27:06
maintainer
docs_urlNone
authorYooMoney
requires_python>=3.5
licenseMIT
keywords yoomoney yookassa payout sdk python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # YooMoney Payout API Python Client Library

[![Build Status](https://travis-ci.org/yoomoney/yookassa-payout-sdk-python.svg?branch=master)](https://travis-ci.org/yoomoney/yookassa-payout-sdk-python)
[![Latest Stable Version](https://img.shields.io/pypi/v/yookassa-payout.svg)](https://pypi.org/project/yookassa-payout/)
[![Total Downloads](https://img.shields.io/pypi/dm/yookassa-payout.svg)](https://pypi.org/project/yookassa-payout/)
[![License](https://img.shields.io/pypi/l/yookassa-payout.svg)](https://git.yoomoney.ru/projects/SDK/repos/yookassa-payout-sdk-python)

[Russian](README.md) | English

Client to work on the [Protocol for mass payouts](https://yookassa.ru/docs/payouts/api/using-api/basics?lang=en)

## Opportunities
You can with this SDK:
1. [Generate a certificate](https://yookassa.ru/docs/payment-solution/supplementary/security?lang=en) for interaction with YooMoney.
2. [Transfer money](https://yookassa.ru/docs/payouts/api/make-deposition/basics?lang=en) to individuals for wallets in YooMoney, mobile phone numbers, Bank cards and accounts (makeDeposition).
3. [To test the possibility of transfer of remittances](https://yookassa.ru/docs/payouts/api/make-deposition/basics?lang=en#test-deposition) to wallets in YooMoney (testDeposition).
4. [Keep track of the balance of payouts](https://yookassa.ru/docs/payouts/api/balance?lang=en) (balance).
5. [Receive notifications](https://yookassa.ru/docs/payouts/api/error-deposition-notification?lang=en) the unsuccessful status of transfers to a Bank account, card, or mobile phone (errorDepositionNotification).

## Requirements
* Python 3.5 (or later version)
* pip

## Installation
### Under console using pip

1. Install pip.
2. In the console, run the following command:
```bash
pip install yookassa-payout
```

### Under console using easy_install
1. Install easy_install.
2. In the console, run the following command:
```bash
easy_install --upgrade yookassa-payout
```

### Manually
1. In the console, run the following command:
```bash
wget https://git.yoomoney.ru/rest/api/latest/projects/SDK/repos/yookassa-payout-sdk-python/archive?format=zip -O yookassa-payout-sdk-python-master.zip
unzip yookassa-payout-sdk-python-master.zip -d yookassa-payout-sdk-python-master
cd yookassa-payout-sdk-python-master
python setup.py install
```

## Getting a certificate for authenticating requests
To interact with YooMoney.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 YooMoney.

### Step 1. Creating a private key and CSR

#### Using the SDK method
1. Import classes to create CSR
```python
from yookassa_payout.domain.models.organization import Organization
from yookassa_payout.payout import Payout
```

2. Create an instance of the `Organization` class with data for creating the request. All data must be entered in Latin.
```python
org = Organization({
    "org_name": "YooMoney",              # Organization Name (Latin)
    "common_name": "/business/yoomoney", # Common Name, for example the name of your organization; must start with В«/business/В»
    "email": "cms@yoomoney.ru"           # Email
})
```
3. Create a CSR and a private key.
```python
# 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.
```bash
cd '<your project folder>'
```

2. Execute the command:
```
yookassa-payout -getcsr
```

3. 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](https://yoomoney.ru/i/forms/ssl_cert_form.doc) 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: <ul><li>*initial* — to get the first certificate;</li><li>*scheduled replacement* — to replace a certificate that has expired;</li><li>*replacement of a compromised* — to replace a previously issued certificate in the event of a security breach;</li><li>*adding a server* — to use the new certificate on additional servers or services.</li></ul> |
| 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 YooMoney
Send the certificate request file (request.csr) and a scan of the request by email to your YooMoney 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 payouts you need and whether you want to check your balance.
2. Import required classes
```python
from yookassa_payout.domain.common.keychain import KeyChain
from yookassa_payout.configuration import Configuration
from yookassa_payout.payout import Payout
```

3. Import the classes you need to solve your problems.
4. 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.
```python
keychain = KeyChain('publicCert.cer', 'privateCert.pem', 'password')
```

5. Create an instance of the `Client` class and pass the gateway ID from the [merchant profile](https://yookassa.ru/my) YooMoney and instance of the `KeyChain` class.
```python
Configuration.configure('000000', keychain)
```

6. Call the appropriate method. [More information about making payouts](https://yookassa.ru/docs/payouts/api/using-api/basics?lang=en)

#### Example of payout to a Bank account
```python
# Importing classes
from yookassa_payout.configuration import Configuration
from yookassa_payout.payout import Payout
from yookassa_payout.domain.common.keychain import KeyChain
from yookassa_payout.domain.models.recipients.bank_account_recipient import BankAccountRecipient
from yookassa_payout.domain.request.make_deposition_request import MakeDepositionRequest

# 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 payout
result = Payout.create_deposition(request)
```
            

Raw data

            {
    "_id": null,
    "home_page": "https://git.yoomoney.ru/projects/SDK/repos/yookassa-payout-sdk-python",
    "name": "yookassa-payout",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.5",
    "maintainer_email": "",
    "keywords": "yoomoney,yookassa,payout,sdk,python",
    "author": "YooMoney",
    "author_email": "cms@yoomoney.ru",
    "download_url": "https://files.pythonhosted.org/packages/6b/09/cae432bf25e21554e2769e7bc3260d4514d20bf633d220850038e3ad7c20/yookassa-payout-2.5.2.tar.gz",
    "platform": null,
    "description": "# YooMoney Payout API Python Client Library\n\n[![Build Status](https://travis-ci.org/yoomoney/yookassa-payout-sdk-python.svg?branch=master)](https://travis-ci.org/yoomoney/yookassa-payout-sdk-python)\n[![Latest Stable Version](https://img.shields.io/pypi/v/yookassa-payout.svg)](https://pypi.org/project/yookassa-payout/)\n[![Total Downloads](https://img.shields.io/pypi/dm/yookassa-payout.svg)](https://pypi.org/project/yookassa-payout/)\n[![License](https://img.shields.io/pypi/l/yookassa-payout.svg)](https://git.yoomoney.ru/projects/SDK/repos/yookassa-payout-sdk-python)\n\n[Russian](README.md) | English\n\nClient to work on the [Protocol for mass payouts](https://yookassa.ru/docs/payouts/api/using-api/basics?lang=en)\n\n## Opportunities\nYou can with this SDK:\n1. [Generate a certificate](https://yookassa.ru/docs/payment-solution/supplementary/security?lang=en) for interaction with YooMoney.\n2. [Transfer money](https://yookassa.ru/docs/payouts/api/make-deposition/basics?lang=en) to individuals for wallets in YooMoney, mobile phone numbers, Bank cards and accounts (makeDeposition).\n3. [To test the possibility of transfer of remittances](https://yookassa.ru/docs/payouts/api/make-deposition/basics?lang=en#test-deposition) to wallets in YooMoney (testDeposition).\n4. [Keep track of the balance of payouts](https://yookassa.ru/docs/payouts/api/balance?lang=en) (balance).\n5. [Receive notifications](https://yookassa.ru/docs/payouts/api/error-deposition-notification?lang=en) the unsuccessful status of transfers to a Bank account, card, or mobile phone (errorDepositionNotification).\n\n## Requirements\n* Python 3.5 (or later version)\n* pip\n\n## Installation\n### Under console using pip\n\n1. Install pip.\n2. In the console, run the following command:\n```bash\npip install yookassa-payout\n```\n\n### Under console using easy_install\n1. Install easy_install.\n2. In the console, run the following command:\n```bash\neasy_install --upgrade yookassa-payout\n```\n\n### Manually\n1. In the console, run the following command:\n```bash\nwget https://git.yoomoney.ru/rest/api/latest/projects/SDK/repos/yookassa-payout-sdk-python/archive?format=zip -O yookassa-payout-sdk-python-master.zip\nunzip yookassa-payout-sdk-python-master.zip -d yookassa-payout-sdk-python-master\ncd yookassa-payout-sdk-python-master\npython setup.py install\n```\n\n## Getting a certificate for authenticating requests\nTo interact with YooMoney.The cashier must obtain a certificate. For this:\n1. Create a private key and a certificate request (CSR).\n2. Fill out the certificate application form.\n3. Exchange data with YooMoney.\n\n### Step 1. Creating a private key and CSR\n\n#### Using the SDK method\n1. Import classes to create CSR\n```python\nfrom yookassa_payout.domain.models.organization import Organization\nfrom yookassa_payout.payout import Payout\n```\n\n2. Create an instance of the `Organization` class with data for creating the request. All data must be entered in Latin.\n```python\norg = Organization({\n    \"org_name\": \"YooMoney\",              # Organization Name (Latin)\n    \"common_name\": \"/business/yoomoney\", # Common Name, for example the name of your organization; must start with \u0412\u00ab/business/\u0412\u00bb\n    \"email\": \"cms@yoomoney.ru\"           # Email\n})\n```\n3. Create a CSR and a private key.\n```python\n# Specify the location where the files should be saved and the password for the private key (if necessary)\nPayout.get_csr(org, './files/output', '12345')\n```\nAs a result, the SDK will generate a private key, CSR, and a text file with an electronic signature (necessary for further steps).\n\n#### Via the console\n1. In the console, go to your project folder.\n```bash\ncd '<your project folder>'\n```\n\n2. Execute the command:\n```\nyookassa-payout -getcsr\n```\n\n3. Enter data for the certificate, following the instructions on the screen. The text must be entered in Latin letters.\nAs a result, the SDK will generate a private key, CSR, and a text file with an electronic signature (necessary for further steps).\n\n### Step 2. Filling out the certificate application\n[Download the application](https://yoomoney.ru/i/forms/ssl_cert_form.doc) to the certificate, fill it out and print it out. Sign and seal the document. Scan.\n\n| **Parameter**                                    | **Description**                                                                                                                                                                                                                                                                                                                                                             |\n|:-------------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| CN                                               | Must match the value of the Common Name parameter (eg, YOUR name). For example, */business/predpriyatie*.                                                                                                                                                                                                                                                                   |\n| Electronic signature of the certificate request  | The text view obtained in the previous step.                                                                                                                                                                                                                                                                                                                                |\n| Organization name in Latin letters               | Must match the value of the Organization Name parameter (eg, company) *Internet Widgits Pty Ltd*.                                                                                                                                                                                                                                                                           |\n| The reason for the request                       | Possible options: <ul><li>*initial* \u0432\u0402\u201d to get the first certificate;</li><li>*scheduled replacement* \u0432\u0402\u201d to replace a certificate that has expired;</li><li>*replacement of a compromised* \u0432\u0402\u201d to replace a previously issued certificate in the event of a security breach;</li><li>*adding a server* \u0432\u0402\u201d to use the new certificate on additional servers or services.</li></ul> |\n| Contact person (full name, phone number, e-mail) | Contact a specialist to contact you if you have any questions about the issued certificate.                                                                                                                                                                                                                                                                                 |\n\n### Step 3. Data exchange with YooMoney\nSend the certificate request file (request.csr) and a scan of the request by email to your YooMoney Manager.Box office.\nIn response to the request, the Manager will send a file with the certificate within 2 business days. The certificate is valid for 1 year.\nPlace the received certificate on your server\n\n## Start of work\n1. Determine what types of payouts you need and whether you want to check your balance.\n2. Import required classes\n```python\nfrom yookassa_payout.domain.common.keychain import KeyChain\nfrom yookassa_payout.configuration import Configuration\nfrom yookassa_payout.payout import Payout\n```\n\n3. Import the classes you need to solve your problems.\n4. 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.\n```python\nkeychain = KeyChain('publicCert.cer', 'privateCert.pem', 'password')\n```\n\n5. Create an instance of the `Client` class and pass the gateway ID from the [merchant profile](https://yookassa.ru/my) YooMoney and instance of the `KeyChain` class.\n```python\nConfiguration.configure('000000', keychain)\n```\n\n6. Call the appropriate method. [More information about making payouts](https://yookassa.ru/docs/payouts/api/using-api/basics?lang=en)\n\n#### Example of payout to a Bank account\n```python\n# Importing classes\nfrom yookassa_payout.configuration import Configuration\nfrom yookassa_payout.payout import Payout\nfrom yookassa_payout.domain.common.keychain import KeyChain\nfrom yookassa_payout.domain.models.recipients.bank_account_recipient import BankAccountRecipient\nfrom yookassa_payout.domain.request.make_deposition_request import MakeDepositionRequest\n\n# Creating a housekeeper and saving settings\nkeychain = KeyChain('./files/250000.cer', './files/privateKey.pem', '12345')\nConfiguration.configure(250000, keychain)\n\n# Getting the current balance\nbalance = Payout.get_balance()\n\n# The compilation of data on the beneficiary\nrecipient = BankAccountRecipient()\nrecipient.pof_offer_accepted = True\nrecipient.bank_name = 'Barclays'\nrecipient.bank_city = 'London'\nrecipient.bank_cor_account = '30101810400000000225'\nrecipient.customer_account = '40817810255030943620'\nrecipient.bank_bik = '042809679'\nrecipient.payment_purpose = 'Refund under the agreement 25-001, without VAT'\nrecipient.pdr_first_name = 'John'\nrecipient.pdr_last_name = 'Watson'\nrecipient.pdr_doc_number = '4002109067'\nrecipient.pdr_doc_issue_date = '1999-07-30'\nrecipient.pdr_address = 'Baker street, 221'\nrecipient.pdr_birth_date = '1987-05-24'\nrecipient.sms_phone_number = '79653457676'\n\n# Preparing a request to create a payout\nrequest = MakeDepositionRequest()\nrequest.agent_id = 250000\nrequest.client_order_id = '215d8da0-000f-50be-b000-0003308c89be'\nrequest.request_dt = '2020-03-04T15:39:45.456+03:00'\nrequest.payment_params = recipient\n\n# The carrying out of the payout\nresult = Payout.create_deposition(request)\n```",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "YooKassa Payout API SDK Python Library",
    "version": "2.5.2",
    "project_urls": {
        "Homepage": "https://git.yoomoney.ru/projects/SDK/repos/yookassa-payout-sdk-python"
    },
    "split_keywords": [
        "yoomoney",
        "yookassa",
        "payout",
        "sdk",
        "python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6b09cae432bf25e21554e2769e7bc3260d4514d20bf633d220850038e3ad7c20",
                "md5": "4a6b9a35c2eed5dc55ef8bbc39352339",
                "sha256": "c0370f23f92aab587ef4e4bb34221466a50e5a3ca5ce80634f08c9677e95dbdd"
            },
            "downloads": -1,
            "filename": "yookassa-payout-2.5.2.tar.gz",
            "has_sig": false,
            "md5_digest": "4a6b9a35c2eed5dc55ef8bbc39352339",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.5",
            "size": 39539,
            "upload_time": "2023-09-27T08:27:06",
            "upload_time_iso_8601": "2023-09-27T08:27:06.261119Z",
            "url": "https://files.pythonhosted.org/packages/6b/09/cae432bf25e21554e2769e7bc3260d4514d20bf633d220850038e3ad7c20/yookassa-payout-2.5.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-27 08:27:06",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "yookassa-payout"
}
        
Elapsed time: 0.13328s