Skip to content

get_account_balance

get_account_balance(
    balance_type: BalanceType,
    *,
    config_overrides: Optional[PaymentsClientConfig] = None,
    next_token: Optional[PaginationToken] = None,
    max_results: Optional[MaxResults] = None,
) -> GetAccountBalanceResponse

Retrieves one balance of your account, selected by balance type, as one amount for each merchant of record and currency. Each amount is the sum of the outstanding balances of your invoices or credit memos that have the status OUTSTANDING. Amounts are never added together across merchants of record or currencies. This operation is eventually consistent. Results are paginated. Use nextToken to retrieve more results.

To use this operation, you must have Amazon Web Services Identity and Access Management (IAM) permission for both payments:GetAccountBalance and payments:GetPaymentStatus.

Parameters:

  • balance_type (BalanceType) –

    The balance to retrieve. You can specify only one balance type in a single request. Each balance adds up the outstanding balance of the records that have the status OUTSTANDING. A record that is PROCESSING, SETTLED, or CANCELED isn't included, even when part of its amount is outstanding. The following values are valid:

    • INVOICES_DUE – The outstanding balance of your OUTSTANDING invoices that aren't past their due date, where dueStatus is DUE.

    • INVOICES_PAST_DUE – The outstanding balance of your OUTSTANDING invoices that are past their due date, where dueStatus is PAST_DUE.

    • OUTSTANDING_CREDIT_MEMOS – The outstanding balance of your OUTSTANDING credit memos: the credit that isn't yet applied to an invoice.

  • next_token (Optional[PaginationToken], default: None ) –

    The pagination token from the nextToken of the previous response. Omit it to get the first page. Tokens expire. If the token is malformed or expired, or doesn't match the original request, the request fails with ValidationException and the reason INVALID_PAGINATION_TOKEN. In that case, start again from the first page.

  • max_results (Optional[MaxResults], default: None ) –

    The maximum number of results to return in one page. The default is 100. A page can contain fewer results even when more remain. Use nextToken to find out whether more results are available.

Raises:

  • AccessDeniedException –

    The request is denied because you don't have sufficient access to perform this operation. Verify that you have the required permissions and try again. This error is also returned, instead of ResourceNotFoundException, when you aren't authorized for the resource, so the response doesn't reveal whether the resource exists.

  • InternalServerException –

    The request processing failed because of an unknown error, exception, or failure. Retry your request.

  • ThrottlingException –

    The request was denied due to request throttling. Reduce the frequency of your requests and try again.

  • ValidationException –

    The request isn't valid. Check reason and fieldList for the cause, correct the request, and try again.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

Invoke GetAccountBalance

>>> client.get_account_balance(balance_type='INVOICES_PAST_DUE')
Source code in docs_src/capo_payments/_services/payments.py
def get_account_balance(
    self,
    balance_type: "capo_payments.types.balance_type.BalanceType",
    *,
    config_overrides: Optional[PaymentsClientConfig] = None,
    next_token: Optional[
        "capo_payments.types.pagination_token.PaginationToken"
    ] = None,
    max_results: Optional["capo_payments.types.max_results.MaxResults"] = None,
) -> "capo_payments.types.get_account_balance_response.GetAccountBalanceResponse":
    """<p>Retrieves one balance of your account, selected by balance type, as one amount for each merchant of record and currency. Each amount is the sum of the outstanding balances of your invoices or credit memos that have the status <code>OUTSTANDING</code>. Amounts are never added together across merchants of record or currencies. This operation is eventually consistent. Results are paginated. Use <code>nextToken</code> to retrieve more results.</p> <p>To use this operation, you must have Amazon Web Services Identity and Access Management (IAM) permission for both <code>payments:GetAccountBalance</code> and <code>payments:GetPaymentStatus</code>.</p>

    Args:
        balance_type: <p>The balance to retrieve. You can specify only one balance type in a single request. Each balance adds up the <code>outstanding</code> balance of the records that have the status <code>OUTSTANDING</code>. A record that is <code>PROCESSING</code>, <code>SETTLED</code>, or <code>CANCELED</code> isn't included, even when part of its amount is outstanding. The following values are valid:</p> <ul> <li> <p> <code>INVOICES_DUE</code> – The outstanding balance of your <code>OUTSTANDING</code> invoices that aren't past their due date, where <code>dueStatus</code> is <code>DUE</code>.</p> </li> <li> <p> <code>INVOICES_PAST_DUE</code> – The outstanding balance of your <code>OUTSTANDING</code> invoices that are past their due date, where <code>dueStatus</code> is <code>PAST_DUE</code>.</p> </li> <li> <p> <code>OUTSTANDING_CREDIT_MEMOS</code> – The outstanding balance of your <code>OUTSTANDING</code> credit memos: the credit that isn't yet applied to an invoice.</p> </li> </ul>
        next_token: <p>The pagination token from the <code>nextToken</code> of the previous response. Omit it to get the first page. Tokens expire. If the token is malformed or expired, or doesn't match the original request, the request fails with <code>ValidationException</code> and the reason <code>INVALID_PAGINATION_TOKEN</code>. In that case, start again from the first page.</p>
        max_results: <p>The maximum number of results to return in one page. The default is 100. A page can contain fewer results even when more remain. Use <code>nextToken</code> to find out whether more results are available.</p>

    Raises:
        capo_payments.errors.access_denied_exception.AccessDeniedException: <p>The request is denied because you don't have sufficient access to perform this operation. Verify that you have the required permissions and try again. This error is also returned, instead of <code>ResourceNotFoundException</code>, when you aren't authorized for the resource, so the response doesn't reveal whether the resource exists.</p>
        capo_payments.errors.internal_server_exception.InternalServerException: <p>The request processing failed because of an unknown error, exception, or failure. Retry your request.</p>
        capo_payments.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling. Reduce the frequency of your requests and try again.</p>
        capo_payments.errors.validation_exception.ValidationException: <p>The request isn't valid. Check <code>reason</code> and <code>fieldList</code> for the cause, correct the request, and try again.</p>
        capo_payments.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Invoke GetAccountBalance

        >>> client.get_account_balance(balance_type='INVOICES_PAST_DUE')
    """

    def _handler(
        req: "OperationRequest[capo_payments.types.get_account_balance_request.GetAccountBalanceRequest]",
    ) -> OperationResponse[
        "capo_payments.types.get_account_balance_response.GetAccountBalanceResponse"
    ]:
        import capo_payments._operations.aws_payments.get_account_balance

        output, http_response = (
            capo_payments._operations.aws_payments.get_account_balance.get_account_balance(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetAccountBalance")
    )
    input_: capo_payments.types.get_account_balance_request.GetAccountBalanceRequest = {
        "balance_type": balance_type
    }
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output