We support three types of search fields:

  • Text fields
  • Multiple value fields
  • Range fields

Learn more about working with search results.

Text fields

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.

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

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

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

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

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

Multiple value fields

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

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

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

Range fields

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

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

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

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

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

gateway.transaction.search(function (search) {
  search.createdAt().between("12/17/2015 17:00", "12/17/2015 17:00");
}, function (err, response) {
});
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.