Skip to content

list_financial_records

list_financial_records(
    types: FinancialRecordTypeList,
    *,
    config_overrides: Optional[PaymentsClientConfig] = None,
    settlement_statuses: Optional[SettlementStatusList] = None,
    issued_after: Optional[datetime] = None,
    issued_before: Optional[datetime] = None,
    sort_by: Optional[FinancialRecordSortField] = None,
    sort_order: Optional[SortOrder] = None,
    next_token: Optional[PaginationToken] = None,
    max_results: Optional[MaxResults] = None,
) -> ListFinancialRecordsResponse

Lists the financial records on your account, with the newest first by default. A financial record is an invoice or a credit memo. You must specify at least one record type in types. You can narrow the results further by settlement status and issue date. This operation returns summaries. To get the details that are specific to a record's type, use GetFinancialRecord or BatchGetFinancialRecord. 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:ListFinancialRecords and payments:GetPaymentStatus.

Parameters:

  • types (FinancialRecordTypeList) –

    The financial record types to return. The following values are valid:

    • INVOICE – An invoice: a bill from Amazon Web Services. Payments and credit memos applied to the invoice settle it.

    • CREDIT_MEMO – A credit memo: a credit issued to your account, for example for a billing correction or a service credit. Applying it to one or more invoices settles it.

  • settlement_statuses (Optional[SettlementStatusList], default: None ) –

    The settlement statuses to filter by. OPEN returns records whose status is OUTSTANDING or PROCESSING. CLOSED returns records whose status is SETTLED or CANCELED. When you omit this member, the operation returns records with both settlement statuses.

  • issued_after (Optional[datetime], default: None ) –

    The earliest date and time to return records for, inclusive. The operation returns the records that were issued at or after this time.

  • issued_before (Optional[datetime], default: None ) –

    The latest date and time to return records for, exclusive. The operation returns the records that were issued before this time. When you specify both issuedAfter and issuedBefore, issuedBefore must be later than issuedAfter.

  • sort_by (Optional[FinancialRecordSortField], default: None ) –

    The field to sort the results by. The default is ISSUED_AT, the date and time when the record was issued.

  • sort_order (Optional[SortOrder], default: None ) –

    The order to sort the results in. The default is DESCENDING, which returns the newest records first. ASCENDING returns the oldest records first.

  • 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 ListFinancialRecords

>>> client.list_financial_records(types=['INVOICE'], settlement_statuses=['CLOSED'], sort_by='ISSUED_AT', sort_order='DESCENDING', max_results=5)
Source code in docs_src/capo_payments/_services/payments.py
def list_financial_records(
    self,
    types: "capo_payments.types.financial_record_type_list.FinancialRecordTypeList",
    *,
    config_overrides: Optional[PaymentsClientConfig] = None,
    settlement_statuses: Optional[
        "capo_payments.types.settlement_status_list.SettlementStatusList"
    ] = None,
    issued_after: Optional[datetime.datetime] = None,
    issued_before: Optional[datetime.datetime] = None,
    sort_by: Optional[
        "capo_payments.types.financial_record_sort_field.FinancialRecordSortField"
    ] = None,
    sort_order: Optional["capo_payments.types.sort_order.SortOrder"] = None,
    next_token: Optional[
        "capo_payments.types.pagination_token.PaginationToken"
    ] = None,
    max_results: Optional["capo_payments.types.max_results.MaxResults"] = None,
) -> "capo_payments.types.list_financial_records_response.ListFinancialRecordsResponse":
    """<p>Lists the financial records on your account, with the newest first by default. A financial record is an invoice or a credit memo. You must specify at least one record type in <code>types</code>. You can narrow the results further by settlement status and issue date. This operation returns summaries. To get the details that are specific to a record's type, use <code>GetFinancialRecord</code> or <code>BatchGetFinancialRecord</code>. 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:ListFinancialRecords</code> and <code>payments:GetPaymentStatus</code>.</p>

    Args:
        types: <p>The financial record types to return. The following values are valid:</p> <ul> <li> <p> <code>INVOICE</code> – An invoice: a bill from Amazon Web Services. Payments and credit memos applied to the invoice settle it.</p> </li> <li> <p> <code>CREDIT_MEMO</code> – A credit memo: a credit issued to your account, for example for a billing correction or a service credit. Applying it to one or more invoices settles it.</p> </li> </ul>
        settlement_statuses: <p>The settlement statuses to filter by. <code>OPEN</code> returns records whose <code>status</code> is <code>OUTSTANDING</code> or <code>PROCESSING</code>. <code>CLOSED</code> returns records whose <code>status</code> is <code>SETTLED</code> or <code>CANCELED</code>. When you omit this member, the operation returns records with both settlement statuses.</p>
        issued_after: <p>The earliest date and time to return records for, inclusive. The operation returns the records that were issued at or after this time.</p>
        issued_before: <p>The latest date and time to return records for, exclusive. The operation returns the records that were issued before this time. When you specify both <code>issuedAfter</code> and <code>issuedBefore</code>, <code>issuedBefore</code> must be later than <code>issuedAfter</code>.</p>
        sort_by: <p>The field to sort the results by. The default is <code>ISSUED_AT</code>, the date and time when the record was issued.</p>
        sort_order: <p>The order to sort the results in. The default is <code>DESCENDING</code>, which returns the newest records first. <code>ASCENDING</code> returns the oldest records first.</p>
        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 ListFinancialRecords

        >>> client.list_financial_records(types=['INVOICE'], settlement_statuses=['CLOSED'], sort_by='ISSUED_AT', sort_order='DESCENDING', max_results=5)
    """

    def _handler(
        req: "OperationRequest[capo_payments.types.list_financial_records_request.ListFinancialRecordsRequest]",
    ) -> OperationResponse[
        "capo_payments.types.list_financial_records_response.ListFinancialRecordsResponse"
    ]:
        import capo_payments._operations.aws_payments.list_financial_records

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListFinancialRecords")
    )
    input_: capo_payments.types.list_financial_records_request.ListFinancialRecordsRequest = {
        "types": types
    }
    if settlement_statuses is not None:
        input_["settlement_statuses"] = settlement_statuses
    if issued_after is not None:
        input_["issued_after"] = issued_after
    if issued_before is not None:
        input_["issued_before"] = issued_before
    if sort_by is not None:
        input_["sort_by"] = sort_by
    if sort_order is not None:
        input_["sort_order"] = sort_order
    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