inttegro.async_resources.balance_transactions
Generated public typing surface. Do not edit by hand.
1# Generated by scripts/generate_async_resources.py; do not edit by hand. 2"""Balance transactions resource for viewing account activity.""" 3from __future__ import annotations 4from ..async_http_client import AsyncHttpClient 5 6class AsyncBalanceTransactions: 7 """ 8 Balance transactions resource for viewing detailed account activity. 9 10 Balance transactions are merchant balance entries caused by payments or refunds. 11 ``type`` is either ``payment`` or ``refund`` and identifies the semantic source, 12 not accounting direction. The matching ``payment_id`` or ``refund_id`` is present. 13 14 See https://studio.inttegro.com/api/balance-transactions for detailed documentation. 15 """ 16 17 def __init__(self, http: AsyncHttpClient): 18 """Initialize BalanceTransactions resource with HTTP client.""" 19 self.http = http 20 21 async def lookup(self, transaction_id: str): 22 """ 23 Retrieve a balance transaction by ID. 24 25 Args: 26 transaction_id: Balance transaction identifier. 27 28 Returns: 29 domain object whose ``transaction`` contains required ``id``, ``type``, 30 ``order_id``, ``amount``, and ``created_at`` fields. Switch on ``type`` to 31 read exactly one matching ``payment_id`` or ``refund_id``. 32 """ 33 return await self.http.post('/balance_transactions/lookup', {'transaction_id': transaction_id}) 34 35 async def page(self, payload: dict | None=None): 36 """ 37 List balance transactions with page-based pagination. 38 39 Retrieves payment- and refund-sourced merchant balance entries, sorted by 40 creation date (most recent first). 41 42 Args: 43 payload: Pagination parameters including: 44 - page_number: Page index to fetch (1-10 inclusive, default: 1) 45 - page_size: Number of transactions per page (1-256, default: 20) 46 47 Returns: 48 domain object containing: 49 - page: Object with: 50 - number: The page number returned 51 - size: Number of transactions in this page 52 - transactions: Array of objects with required ``id``, ``type``, 53 ``order_id``, ``amount``, and ``created_at``. A payment entry has 54 ``payment_id``; a refund entry has ``refund_id``. 55 56 Example: 57 ```python 58 # Get first page 59 result = client.balance_transactions.page({"page_number": 1, "page_size": 20}) 60 page = result.page 61 62 for txn in page["transactions"]: 63 source_id = txn["payment_id"] if txn["type"] == "payment" else txn["refund_id"] 64 print(f"{txn['id']} ({txn['type']} {source_id}): {txn['amount']['value']}") 65 66 # Get second page 67 result = client.balance_transactions.page({"page_number": 2, "page_size": 20}) 68 ``` 69 70 See Also: 71 - Orders.page(): List orders (source of payment transactions) 72 - Payouts.page(): List payouts (source of payout transactions) 73 - https://studio.inttegro.com/api/balance-transactions/page 74 """ 75 return await self.http.post('/balance_transactions/page', payload or {})
7class AsyncBalanceTransactions: 8 """ 9 Balance transactions resource for viewing detailed account activity. 10 11 Balance transactions are merchant balance entries caused by payments or refunds. 12 ``type`` is either ``payment`` or ``refund`` and identifies the semantic source, 13 not accounting direction. The matching ``payment_id`` or ``refund_id`` is present. 14 15 See https://studio.inttegro.com/api/balance-transactions for detailed documentation. 16 """ 17 18 def __init__(self, http: AsyncHttpClient): 19 """Initialize BalanceTransactions resource with HTTP client.""" 20 self.http = http 21 22 async def lookup(self, transaction_id: str): 23 """ 24 Retrieve a balance transaction by ID. 25 26 Args: 27 transaction_id: Balance transaction identifier. 28 29 Returns: 30 domain object whose ``transaction`` contains required ``id``, ``type``, 31 ``order_id``, ``amount``, and ``created_at`` fields. Switch on ``type`` to 32 read exactly one matching ``payment_id`` or ``refund_id``. 33 """ 34 return await self.http.post('/balance_transactions/lookup', {'transaction_id': transaction_id}) 35 36 async def page(self, payload: dict | None=None): 37 """ 38 List balance transactions with page-based pagination. 39 40 Retrieves payment- and refund-sourced merchant balance entries, sorted by 41 creation date (most recent first). 42 43 Args: 44 payload: Pagination parameters including: 45 - page_number: Page index to fetch (1-10 inclusive, default: 1) 46 - page_size: Number of transactions per page (1-256, default: 20) 47 48 Returns: 49 domain object containing: 50 - page: Object with: 51 - number: The page number returned 52 - size: Number of transactions in this page 53 - transactions: Array of objects with required ``id``, ``type``, 54 ``order_id``, ``amount``, and ``created_at``. A payment entry has 55 ``payment_id``; a refund entry has ``refund_id``. 56 57 Example: 58 ```python 59 # Get first page 60 result = client.balance_transactions.page({"page_number": 1, "page_size": 20}) 61 page = result.page 62 63 for txn in page["transactions"]: 64 source_id = txn["payment_id"] if txn["type"] == "payment" else txn["refund_id"] 65 print(f"{txn['id']} ({txn['type']} {source_id}): {txn['amount']['value']}") 66 67 # Get second page 68 result = client.balance_transactions.page({"page_number": 2, "page_size": 20}) 69 ``` 70 71 See Also: 72 - Orders.page(): List orders (source of payment transactions) 73 - Payouts.page(): List payouts (source of payout transactions) 74 - https://studio.inttegro.com/api/balance-transactions/page 75 """ 76 return await self.http.post('/balance_transactions/page', payload or {})
Balance transactions resource for viewing detailed account activity.
Balance transactions are merchant balance entries caused by payments or refunds.
type is either payment or refund and identifies the semantic source,
not accounting direction. The matching payment_id or refund_id is present.
See https://studio.inttegro.com/api/balance-transactions for detailed documentation.
18 def __init__(self, http: AsyncHttpClient): 19 """Initialize BalanceTransactions resource with HTTP client.""" 20 self.http = http
Initialize BalanceTransactions resource with HTTP client.
22 async def lookup(self, transaction_id: str): 23 """ 24 Retrieve a balance transaction by ID. 25 26 Args: 27 transaction_id: Balance transaction identifier. 28 29 Returns: 30 domain object whose ``transaction`` contains required ``id``, ``type``, 31 ``order_id``, ``amount``, and ``created_at`` fields. Switch on ``type`` to 32 read exactly one matching ``payment_id`` or ``refund_id``. 33 """ 34 return await self.http.post('/balance_transactions/lookup', {'transaction_id': transaction_id})
Retrieve a balance transaction by ID.
Arguments:
- transaction_id: Balance transaction identifier.
Returns:
domain object whose
transactioncontains requiredid,type,order_id,amount, andcreated_atfields. Switch ontypeto read exactly one matchingpayment_idorrefund_id.
36 async def page(self, payload: dict | None=None): 37 """ 38 List balance transactions with page-based pagination. 39 40 Retrieves payment- and refund-sourced merchant balance entries, sorted by 41 creation date (most recent first). 42 43 Args: 44 payload: Pagination parameters including: 45 - page_number: Page index to fetch (1-10 inclusive, default: 1) 46 - page_size: Number of transactions per page (1-256, default: 20) 47 48 Returns: 49 domain object containing: 50 - page: Object with: 51 - number: The page number returned 52 - size: Number of transactions in this page 53 - transactions: Array of objects with required ``id``, ``type``, 54 ``order_id``, ``amount``, and ``created_at``. A payment entry has 55 ``payment_id``; a refund entry has ``refund_id``. 56 57 Example: 58 ```python 59 # Get first page 60 result = client.balance_transactions.page({"page_number": 1, "page_size": 20}) 61 page = result.page 62 63 for txn in page["transactions"]: 64 source_id = txn["payment_id"] if txn["type"] == "payment" else txn["refund_id"] 65 print(f"{txn['id']} ({txn['type']} {source_id}): {txn['amount']['value']}") 66 67 # Get second page 68 result = client.balance_transactions.page({"page_number": 2, "page_size": 20}) 69 ``` 70 71 See Also: 72 - Orders.page(): List orders (source of payment transactions) 73 - Payouts.page(): List payouts (source of payout transactions) 74 - https://studio.inttegro.com/api/balance-transactions/page 75 """ 76 return await self.http.post('/balance_transactions/page', payload or {})
List balance transactions with page-based pagination.
Retrieves payment- and refund-sourced merchant balance entries, sorted by creation date (most recent first).
Arguments:
- payload: Pagination parameters including:
- page_number: Page index to fetch (1-10 inclusive, default: 1)
- page_size: Number of transactions per page (1-256, default: 20)
Returns:
domain object containing: - page: Object with: - number: The page number returned - size: Number of transactions in this page - transactions: Array of objects with required
id,type,order_id,amount, andcreated_at. A payment entry haspayment_id; a refund entry hasrefund_id.
Example:
# Get first page result = client.balance_transactions.page({"page_number": 1, "page_size": 20}) page = result.page for txn in page["transactions"]: source_id = txn["payment_id"] if txn["type"] == "payment" else txn["refund_id"] print(f"{txn['id']} ({txn['type']} {source_id}): {txn['amount']['value']}") # Get second page result = client.balance_transactions.page({"page_number": 2, "page_size": 20})
See Also:
- Orders.page(): List orders (source of payment transactions)
- Payouts.page(): List payouts (source of payout transactions)
- https://studio.inttegro.com/api/balance-transactions/page