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