Search Fields

We support three types of search fields:

  • Text fields
  • Multiple value fields
  • Range fields

Text fields

Text Fields can be searched using 5 operators: is, is_not, starts_with, ends_with, and contains. Here is an example searching for customer email on a transaction.

search_results = Braintree::Transaction.search do |search|
  search.customer_email.is "john.smith@example.com"
end

search_results = Braintree::Transaction.search do |search|
  search.customer_email.is_not "john.smith@example.com"
end

search_results = Braintree::Transaction.search do |search|
  search.customer_email.starts_with "john.smith"
end

search_results = Braintree::Transaction.search do |search|
  search.customer_email.ends_with "example.com"
end

search_results = Braintree::Transaction.search do |search|
  search.customer_email.contains "smith"
end
Ruby

Multiple value fields

Search fields that accept multiple values support two operators: is and in.

search_results = Braintree::Transaction.search do |search|
  search.status.is Braintree::Transaction::Status::Authorized
end

search_results = Braintree::Transaction.search do |search|
  search.status.in(
    Braintree::Transaction::Status::Authorized,
    Braintree::Transaction::Status::SubmittedForSettlement
  )
end
Ruby

Range fields

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

search_results = Braintree::Transaction.search do |search|
  search.amount.is("15.00")
end

search_results = Braintree::Transaction.search do |search|
  search.amount >= "10.00"
end

search_results = Braintree::Transaction.search do |search|
  search.amount <= "20.00"
end

search_results = Braintree::Transaction.search do |search|
  search.amount.between("10.00", "20.00")
end

search_results = Braintree::Transaction.search do |search|
  search.created_at.between("12/17/2015 17:00", "12/17/2015 17:00")
end
Ruby

Note: Date ranges are precise to the minute, so 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.


Still Have Questions?

If you can’t find an answer, give us a call at 877.434.2894 or email our Support team.