Client

class aioplatega.client.platega.Platega[source]

Bases: object

Async client for the Platega payment API.

Usage:

async with Platega(merchant_id="...", secret="...") as client:
    result = await client.create_transaction(...)
__init__(merchant_id, secret, session=None)[source]

Initialize the Platega client.

Parameters:
  • merchant_id (str) – Your Platega merchant identifier.

  • secret (str) – Your Platega secret key.

  • session (BaseSession | None) – Optional custom session. If not provided, an AiohttpSession is created automatically.

Return type:

None

async create_transaction(*, payment_method, payment_details, description=None, return_url=None, failed_url=None, payload=None)[source]

Create a new payment transaction.

Parameters:
  • payment_method (PaymentMethodInt) – Payment method identifier (e.g. PaymentMethodInt.SBP_QR).

  • payment_details (PaymentDetails) – Amount and currency for the payment.

  • description (str | None) – Optional human-readable description.

  • return_url (str | None) – URL to redirect the user after successful payment.

  • failed_url (str | None) – URL to redirect the user after failed payment.

  • payload (str | None) – Arbitrary string passed through to the callback.

Return type:

CreateTransactionResponse

Returns:

Response containing the transaction ID, status, and redirect URL.

async get_transaction_status(transaction_id)[source]

Get the current status of a transaction.

Parameters:

transaction_id (str) – UUID of the transaction to query.

Return type:

TransactionStatusResponse

Returns:

Full transaction details including status and payment info.

async get_rate(*, payment_method, currency_from, currency_to)[source]

Get the current exchange rate for a payment method.

Parameters:
  • payment_method (int) – Payment method identifier (int value).

  • currency_from (str) – Source currency code (e.g. "USDT").

  • currency_to (str) – Target currency code (e.g. "RUB").

Return type:

RateResponse

Returns:

Current rate and last update timestamp.

async get_conversions(*, from_date=None, to_date=None, page=0, size=20)[source]

Get a paginated list of balance-unlock (conversion) operations.

Parameters:
  • from_date (str | None) – Start date filter (ISO format string).

  • to_date (str | None) – End date filter (ISO format string).

  • page (int) – Zero-based page number.

  • size (int) – Number of items per page.

Return type:

ConversionsResponse

Returns:

Paginated response with conversion items.

async close()[source]

Close the underlying HTTP session and release resources.

Return type:

None