Searching

Search Fieldsanchor

We support three types of search fields:

  • Text fields
  • Multiple value fields
  • Range fields

Learn more about working with search results.

Text fieldsanchor

Text Fields can be searched using 5 operators: ==, !=, starts_with, ends_with, and contains. Each search Text Field can't exceed 255 characters. Here is an example searching for customer email on a transaction.

  1. Python
search_results = gateway.transaction.search([
    braintree.TransactionSearch.customer_email == "john.smith@example.com"
])

search_results = gateway.transaction.search([
    braintree.TransactionSearch.customer_email != "john.smith@example.com"
])

search_results = gateway.transaction.search([
    braintree.TransactionSearch.customer_email.starts_with("john.smith")
])

search_results = gateway.transaction.search([
    braintree.TransactionSearch.customer_email.ends_with("example.com")
])

search_results = gateway.transaction.search([
    braintree.TransactionSearch.customer_email.contains("smith")
])

Multiple value fieldsanchor

Search fields that accept multiple values support two operators: == and in_list.

  1. Python
search_results = gateway.transaction.search([
    braintree.TransactionSearch.status == braintree.Transaction.Status.Authorized
])

search_results = gateway.transaction.search([
    braintree.TransactionSearch.status.in_list([
        braintree.Transaction.Status.Authorized,
        braintree.Transaction.Status.SubmittedForSettlement
    ])
])

Range fieldsanchor

Ranges support four operators: ==, between, >=, and <=. between is inclusive.

  1. Python
search_results = gateway.transaction.search([
    braintree.TransactionSearch.amount == "15.00"
])

search_results = gateway.transaction.search([
    braintree.TransactionSearch.amount >= "10.00"
])

search_results = gateway.transaction.search([
    braintree.TransactionSearch.amount <= "20.00"
])

search_results = gateway.transaction.search([
    braintree.TransactionSearch.amount.between("10.00", "20.00")
])

search_results = gateway.transaction.search([
    braintree.TransactionSearch.created_at.between("12/17/2015 17:00", "12/17/2015 17:00")
])
note

Ranges with a date/time value are precise to the minute; the results of search for transactions created between 12/17/2015 17:00 and 12/17/2015 17:00 will include a transaction created at 12/17/2015 17:00:59.