Payment Method Data Types

Типы данных для указания способа оплаты при создании платежа.

PaymentMethodData

Union тип, объединяющий все возможные способы оплаты.

aioyookassa.types.params.PaymentMethodData

alias of SberLoanPaymentMethodData | MobileBalancePaymentMethodData | BankCardPaymentMethodData | CashPaymentMethodData | SberBnplPaymentMethodData | SbpPaymentMethodData | B2BSberbankPaymentMethodData | ElectronicCertificatePaymentMethodData | YooMoneyPaymentMethodData | SberbankPaymentMethodData | TinkoffBankPaymentMethodData

Способы оплаты

SberLoanPaymentMethodData

Способ оплаты “Сбербанк в рассрочку”.

class aioyookassa.types.params.SberLoanPaymentMethodData(*, type: str = 'sber_loan')[source]

Bases: BaseModel

Sber Loan payment method data.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

MobileBalancePaymentMethodData

Способ оплаты с баланса мобильного телефона.

class aioyookassa.types.params.MobileBalancePaymentMethodData(*, type: str = 'mobile_balance', phone: str)[source]

Bases: BaseModel

Mobile balance payment method data.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

BankCardPaymentMethodData

Способ оплаты банковской картой.

class aioyookassa.types.params.BankCardPaymentMethodData(*, type: str = 'bank_card', card: PaymentMethodCardData | None = None)[source]

Bases: BaseModel

Bank card payment method data.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

CashPaymentMethodData

Способ оплаты наличными.

class aioyookassa.types.params.CashPaymentMethodData(*, type: str = 'cash', phone: str | None = None)[source]

Bases: BaseModel

Cash payment method data.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

SberBnplPaymentMethodData

Способ оплаты “Плати частями” от Сбербанка.

class aioyookassa.types.params.SberBnplPaymentMethodData(*, type: str = 'sber_bnpl', phone: str | None = None)[source]

Bases: BaseModel

Sber BNPL payment method data.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

SbpPaymentMethodData

Способ оплаты через Систему быстрых платежей (СБП).

class aioyookassa.types.params.SbpPaymentMethodData(*, type: str = 'sbp')[source]

Bases: BaseModel

SBP payment method data.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

B2BSberbankPaymentMethodData

Способ оплаты B2B Сбербанк.

class aioyookassa.types.params.B2BSberbankPaymentMethodData(*, type: str = 'b2b_sberbank', payment_purpose: str, vat_data: VatData)[source]

Bases: BaseModel

B2B Sberbank payment method data.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

ElectronicCertificatePaymentMethodData

Способ оплаты электронным сертификатом.

class aioyookassa.types.params.ElectronicCertificatePaymentMethodData(*, type: str = 'electronic_certificate', articles: List[ElectronicCertificateArticle] | None = None, card: PaymentMethodCardData | None = None, electronic_certificate: ElectronicCertificateData | None = None)[source]

Bases: BaseModel

Electronic certificate payment method data.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

YooMoneyPaymentMethodData

Способ оплаты через YooMoney.

class aioyookassa.types.params.YooMoneyPaymentMethodData(*, type: str = 'yoo_money')[source]

Bases: BaseModel

YooMoney payment method data.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

SberbankPaymentMethodData

Способ оплаты через Сбербанк Онлайн.

class aioyookassa.types.params.SberbankPaymentMethodData(*, type: str = 'sberbank', phone: str | None = None)[source]

Bases: BaseModel

Sberbank payment method data.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

TinkoffBankPaymentMethodData

Способ оплаты через Тинькофф Банк.

class aioyookassa.types.params.TinkoffBankPaymentMethodData(*, type: str = 'tinkoff_bank')[source]

Bases: BaseModel

Tinkoff Bank payment method data.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Вспомогательные типы

PaymentMethodCardData

Данные банковской карты для способов оплаты.

class aioyookassa.types.params.PaymentMethodCardData(*, number: str, expiry_year: str, expiry_month: str, cardholder: str | None = None, csc: str | None = None)[source]

Bases: BaseModel

Bank card data for payment method creation.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

ElectronicCertificateArticle

Статья для электронного сертификата.

class aioyookassa.types.params.ElectronicCertificateArticle(*, article_number: int, tru_code: str, article_code: str | None = None, article_name: str, quantity: int, price: Money, metadata: dict | None = None)[source]

Bases: BaseModel

Article for electronic certificate payment.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

ElectronicCertificateData

Данные электронного сертификата от ФЭС НСПК.

class aioyookassa.types.params.ElectronicCertificateData(*, amount: Money, basket_id: str)[source]

Bases: BaseModel

Electronic certificate data from FES NSPK.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Примеры использования

Банковская карта

from aioyookassa.types.params import (
    BankCardPaymentMethodData,
    PaymentMethodCardData,
)

payment_method_data = BankCardPaymentMethodData(
    type="bank_card",
    card=PaymentMethodCardData(
        number="4111111111111111",
        expiry_year="2025",
        expiry_month="12",
        cardholder="John Doe",
        csc="123"
    )
)

Мобильный баланс

from aioyookassa.types.params import MobileBalancePaymentMethodData

payment_method_data = MobileBalancePaymentMethodData(
    type="mobile_balance",
    phone="79000000000"
)

СБП

from aioyookassa.types.params import SbpPaymentMethodData

payment_method_data = SbpPaymentMethodData(type="sbp")

B2B Сбербанк

from aioyookassa.types.params import B2BSberbankPaymentMethodData
from aioyookassa.types.payment import VatData, PaymentAmount

payment_method_data = B2BSberbankPaymentMethodData(
    type="b2b_sberbank",
    payment_purpose="Оплата по договору №123",
    vat_data=VatData(
        type="calculated",
        amount=PaymentAmount(value="100.00", currency="RUB"),
        rate="20"
    )
)

Электронный сертификат

from aioyookassa.types.params import (
    ElectronicCertificatePaymentMethodData,
    ElectronicCertificateArticle,
    ElectronicCertificateData,
    PaymentAmount,
)

payment_method_data = ElectronicCertificatePaymentMethodData(
    type="electronic_certificate",
    articles=[
        ElectronicCertificateArticle(
            article_number=1,
            tru_code="329921120.06001010200080001643",
            article_name="Товар",
            quantity=1,
            price=PaymentAmount(value="100.00", currency="RUB")
        )
    ],
    electronic_certificate=ElectronicCertificateData(
        amount=PaymentAmount(value="100.00", currency="RUB"),
        basket_id="basket_123"
    )
)