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: is, isNot, startsWith, endsWith, and contains. Each search Text Field can't exceed 255 characters. Here is an example searching for customer email on a transaction.

  1. Node.js
gateway.transaction.search((search) => {
  search.customerEmail().is("john.smith@example.com");
}, (err, response) => {
});

gateway.transaction.search((search) => {
  search.customerEmail().isNot("john.smith@example.com");
}, (err, response) => {
});

gateway.transaction.search((search) => {
  search.customerEmail().startsWith("john.smith");
}, (err, response) => {
});

gateway.transaction.search((search) => {
  search.customerEmail().endsWith("@example.com");
}, (err, response) => {
});

gateway.transaction.search((search) => {
  search.customerEmail().contains("smith");
}, (err, response) => {
});

Multiple value fieldsanchor

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

  1. Node.js
gateway.transaction.search((search) => {
  search.status().is(braintree.Transaction.Status.Authorized);
}, (err, response) => {
});

gateway.transaction.search((search) => {
  search.status().in([
    braintree.Transaction.Status.Authorized,
    braintree.Transaction.Status.SubmittedForSettlement
  ]);
}, (err, response) => {
});

Range fieldsanchor

Ranges support four operators: is, between, max, and min.

For non-time-based filters, between is inclusive and max and min are respected as written.

For time-based filters, the lower bound will always be inclusive and the upper bound will always be exclusive, regardless of the range operator used. Additionally, one minute is automatically added to the upper bound.

Example: A search condition of "between 12/17/2015 16:00 and 12/17/2015 17:00" will include transactions created at 12/17/2015 16:00:00 and 12/17/2015 17:00:59 but will not include a transaction created at 12/17/2015 17:01:00.

  1. Node.js
gateway.transaction.search((search) => {
  search.amount().is("100.00");
}, (err, response) => {
});

gateway.transaction.search((search) => {
  search.amount().min("100.00");
}, (err, response) => {
});

gateway.transaction.search((search) => {
  search.amount().max("200.00");
}, (err, response) => {
});

gateway.transaction.search((search) => {
  search.amount().between("100.00", "200.00");
}, (err, response) => {
});

gateway.transaction.search((search) => {
  search.createdAt().between("12/17/2015 17:00", "12/17/2015 17:00");
}, (err, response) => {
});