YooMoney API#

class glQiwiApi.yoo_money.client.YooMoneyAPI(api_access_token: str, request_service_factory: Optional[Callable[[...], Union[Awaitable[RequestServiceProto], RequestServiceProto]]] = None)[source]#

Bases: glQiwiApi.core.abc.base_api_client.BaseAPIClient

That class implements processing requests to YooMoney It is convenient in that it does not just give json such objects, and all this converts into pydantic models. To work with this class, you need to register a token, using the guide on the official github of the project

__init__(api_access_token: str, request_service_factory: Optional[Callable[[...], Union[Awaitable[RequestServiceProto], RequestServiceProto]]] = None) None[source]#
The constructor accepts a token obtained from the method class get_access_token

and the special attribute without_context

Parameters

api_access_token – api token for requests

async classmethod build_url_for_auth(scopes: List[str], client_id: str, redirect_uri: str = 'https://example.com') str[source]#

Method to get the link for further authorization and obtaining a token

Parameters
  • scopes – OAuth2 authorization of the application by the user, the rights are transferred by the list.

  • client_id – application id, type string

  • redirect_uri – a funnel where the temporary code that you need will go to to get the main token

Returns

the link to follow and make authorization via login / password

async classmethod get_access_token(code: str, client_id: str, redirect_uri: str = 'https://example.com', client_secret: Optional[str] = None) str[source]#

Method for obtaining a token for requests to the YooMoney API

Parameters
  • code – the temporary code that was obtained in the base_authorize method

  • client_id – application id, type string

  • redirect_uri – the funnel where the temporary code will go, which is needed to get the main token

  • client_secret – The secret word for authenticating the application. Specified if the service is registered with authentication.

Returns

YooMoney API TOKEN

async revoke_api_token(*args: Any, **kw: Any) Any#
classmethod create_pay_form(receiver: str, quick_pay_form: str, targets: str, payment_type: str, amount: Union[int, float], form_comment: Optional[str] = None, short_dest: Optional[str] = None, label: Optional[str] = None, comment: Optional[str] = None, success_url: Optional[str] = None, need_fio: Optional[bool] = None, need_email: Optional[bool] = None, need_phone: Optional[bool] = None, need_address: Optional[bool] = None) str[source]#

The YooMoney form is a set of fields with information about a transfer. You can embed payment form into your interface (for instance, a website or blog). When the sender pushes the button, the details from the form are sent to YooMoney and an order for a transfer to your wallet is initiated.

Detail docs: https://yoomoney.ru/docs/payment-buttons/using-api/forms?lang=en

Possible values for quick_pay_form:
  • shop - for a multi purpose form;

  • small - for a button;

  • donate - for a charity form.

@param receiver: Number of the YooMoney wallet which money from senders is credited to. @param quick_pay_form: @param targets: Payment purpose. @param payment_type: Payment method. Possible values: PC, AC, MC @param amount: Transfer amount (the amount debited from the sender). @param form_comment: Name of the transfer in sender’s history

(for transfers from a wallet or linked bank card). Displayed in sender’s wallet. The simplest way to create it is to combine the names of the store and product. For instance: My Store: white valenki boots

@param short_dest: Name of the transfer on the confirmation page.

We recommend using the same name as formcomment

@param label: The label that a site or app assigns to a certain transfer.

For instance, a code or order identifier may be used for this label.

@param comment: The field in which you can transfer_money sender’s comments. @param success_url: URL where the user is redirected after the transfer. @param need_fio: Sender’s full name required. @param need_email: Sender’s email address required. @param need_phone: Sender’s phone number required. @param need_address: Sender’s address required. @return: link to payment form

async retrieve_account_info(*args: Any, **kw: Any) Any#
async operation_history(*args: Any, **kw: Any) Any#
async operation_details(*args: Any, **kw: Any) Any#
async make_cellular_payment(*args: Any, **kw: Any) Any#
async transfer_money(*args: Any, **kw: Any) Any#
async make_request_payment(*args: Any, **kw: Any) Any#
async get_balance(*args: Any, **kw: Any) Any#
async accept_incoming_transaction(*args: Any, **kw: Any) Any#
async reject_incoming_transfer(*args: Any, **kw: Any) Any#
async check_if_operation_exists(*args: Any, **kw: Any) Any#