Sync API
Синхрон клиент
- class qpay_client.v2.QPayClient(settings: QPaySettings, *, client: Client | None = None, logger: Logger | None = None)[source]
Bases:
BaseClientSynchronous client for the QPay v2 API.
Always use as a context manager. Authentication runs on
__enter__and the HTTP connection is closed on__exit__:settings = QPaySettings.production( username="...", password="...", invoice_code="..." ) with QPayClient(settings) as client: invoice = client.invoice_create(InvoiceCreateSimpleRequest(...)) result = client.payment_check(PaymentCheckRequest(...))
Available endpoints:
invoice_create,invoice_get,invoice_cancel,payment_get,payment_check,payment_cancel,payment_refund,payment_list,ebarimt_create,ebarimt_get,subscription_get,subscription_cancel.Not thread-safe. Use one instance per thread or protect access with a lock.
- property is_closed: bool
Returns True of connection is closed.
- invoice_create(create_invoice_request: InvoiceCreateRequest | InvoiceCreateSimpleRequest) InvoiceCreateResponse[source]
Create invoice.
- payment_check(payment_check_request: PaymentCheckRequest) PaymentCheckResponse[source]
Check payment status, polling until a payment is found or retries exhausted.