Returns a collection of Transaction response objects.

For operators available on search fields, see the search fields page.

Java
Copy
Copied
TransactionSearchRequest request = new TransactionSearchRequest()
  .customerId().is("the_customer_id");

ResourceCollection<Transaction> collection = gateway.transaction().search(request);

for (Transaction transaction : collection) {
  System.out.println(transaction.getAmount());
}
Parameters
.amount(…) range

The amount of the transaction. The amount must be formatted like xx or x.xx.

.authorizationExpiredAt(…) range

The date/time the transaction's authorization expired.

.authorizedAt(…) range

The date/time the transaction was authorized.

.billingCompany(…) text

The company name on the billing address used for the transaction.

.billingCountryName(…) text

The country name on the billing address used for the transaction.

.billingExtendedAddress(…) text

The extended address on the billing address used for the transaction.

.billingFirstName(…) text

The first name on the billing address used for the transaction.

.billingLastName(…) text

The last name on the billing address used for the transaction.

.billingLocality(…) text

The locality (e.g. city) on the billing address used for the transaction.

.billingPostalCode(…) text

The postal code on the billing address used for the transaction.

.billingRegion(…) text

The region (e.g. state) on the billing address used for the transaction.

.billingStreetAddress(…) text

The street address on the billing address used for the transaction.

.createdAt(…) range

The date/time at which the transaction was created.

.createdUsing(…) multiple

The data used to create the transaction. Possible values:

  • Transaction.CreatedUsing.TOKEN
  • Transaction.CreatedUsing.FULL_INFORMATION
.creditCardCardType(…) multiple

The type of credit card used in the transaction. Possible values:

  • "American Express"
  • "Discover"
  • "Maestro"
  • "JCB"
  • "MasterCard"
  • "UnionPay"
  • "Visa"
.creditCardCardholderName(…) text

The cardholder name in the transaction. This only applies to credit card transactions.

.creditCardCustomerLocation(…) multiple

The location of the customer in the transaction. Possible values:

  • international
  • us
.creditCardExpirationDate(…) text

The expiration date of the card used in the transaction. This only applies to credit card transactions.

.creditCardNumber(…) text

The number of the card used in the transaction.

Card number search is restricted: starts with searches up to the first 6 digits, ends with searches last 4 digits, and contains is not allowed.

.creditCardUniqueIdentifier(…) text

The unique identifier of the card number. See the transaction response reference for more details.

.currency(…) text

The currency of the transaction.

.customerCompany(…) text

The customer's company associated with the transaction.

.customerEmail(…) text

The customer's email address associated with the transaction.

.customerFax(…) text

The customer's fax number associated with the transaction.

.customerFirstName(…) text

The customer's first name associated with the transaction.

.customerId(…) text

A string value representing an existing customer in your Vault that is associated with the transaction.

.customerLastName(…) text

The customer's last name associated with the transaction.

.customerPhone(…) text

The customer's phone number associated with the transaction.

.customerWebsite(…) text

The customer's website associated with the transaction.

.disbursementDate(…) range

Only available for certain account types; contact us for details.

The date the transaction was disbursed to your bank account. This field does not include a time value.

.disputeDate(…) range

Only available for certain account types; contact us for details.

The date the transaction was disputed. This field does not include a time value.

.failedAt(…) range

The date/time the transaction failed.

.gatewayRejectedAt(…) range

The date/time the transaction was rejected by the gateway.

.id(…) text

The ID of the transaction.

.ids(…) multiple

The list of transaction IDs to search for.

.merchantAccountId(…) multiple

The merchant account IDs associated with transactions.

.orderId(…) text

The order ID of the transaction. On PayPal transactions, this field maps to the PayPal invoice number. PayPal invoice numbers are unique in your PayPal business account. Maximum 255 characters or 127 for PayPal transactions.

.paymentInstrumentType(…) multiple

The method of payment used to process the transaction. Possible values:

  • "android_pay_card"
  • "apple_pay_card"
  • "credit_card"
  • "masterpass_card"
  • "paypal_account"
  • "samsung_pay_card"
  • "venmo_account"
  • "visa_checkout_card"
.paymentMethodToken(…) text

The payment method token used in the transaction.

.paypalAuthorizationId(…) text

The Authorization ID for a PayPal transaction.

.paypalPayerEmail(…) text

The PayPal account holder's email for a PayPal transaction.

.paypalPaymentId(…) text

The identification value of the payment in PayPal's API for a PayPal transaction.

.processorAuthorizationCode(…) text

The authorization code returned by the processor for the transaction.

.processorDeclinedAt(…) range

The date/time the transaction was declined by the processor

.refund(…) multiple

Whether or not the transaction is a refund. The value may be either true or false. This parameter must be used in conjunction with type().

.settledAt(…) range

The date/time the transaction finished settling.

.settlementBatchId(…) text

ID of the batch the transaction was submitted for settlement under.

.shippingCompany(…) text

The company name on the shipping address used for the transaction.

.shippingCountryName(…) text

The country name on the shipping address used for the transaction.

.shippingExtendedAddress(…) text

The extended address on the shipping address used for the transaction.

.shippingFirstName(…) text

The first name on the shipping address used for the transaction.

.shippingLastName(…) text

The last name on the shipping address used for the transaction.

.shippingLocality(…) text

The locality (e.g. city) on the shipping address used for the transaction.

.shippingPostalCode(…) text

The postal code on the shipping address used for the transaction.

.shippingRegion(…) text

The region (e.g. state) on the shipping address used for the transaction.

.shippingStreetAddress(…) text

The street address on the shipping address used for the transaction.

.source(…) multiple

How a transaction was created. Possible values:

  • API
  • CONTROL_PANEL
  • RECURRING
  • OAuth application client ID of the transaction facilitator
.status(…) multiple

The list of statuses to search for. Possible statuses:

  • AUTHORIZING
  • AUTHORIZED
  • AUTHORIZATION_EXPIRED
  • SUBMITTED_FOR_SETTLEMENT
  • SETTLING
  • SETTLEMENT_PENDING
  • SETTLEMENT_DECLINED
  • SETTLED
  • VOIDED
  • PROCESSOR_DECLINED
  • GATEWAY_REJECTED
  • FAILED
.submittedForSettlementAt(…) range

The date/time the transaction was submitted for settlement.

.type(…) multiple

Possible values:

  • SALE
  • CREDIT
.user(…) multiple

A list of user IDs used to create the transaction. Specifically refers to Control Panel users and/or API users.

.voidedAt(…) range

The date/time the transaction was voided.

Examples

Credit card

Java
Copy
Copied
TransactionSearchRequest request = new TransactionSearchRequest()
  .creditCardCardholderName().is("Patrick Smith")
  .creditCardExpirationDate().is("05/2012")
  .creditCardNumber().endsWith("1111");

ResourceCollection<Transaction> collection = gateway.transaction().search(request);

Searching On Customer Details

Java
Copy
Copied
TransactionSearchRequest request = new TransactionSearchRequest()
  .customerCompany().is("Braintree")
  .customerEmail().is("smith@example.com")
  .customerFax().is("5551231234")
  .customerFirstName().is("Tom")
  .customerLastName().is("Smith")
  .customerPhone().is("5551231234")
  .customerWebsite().is("http://example.com");

ResourceCollection<Transaction> collection = gateway.transaction().search(request);

See search fields for a list of available operators. They allow you to do nice things like this:

Java
Copy
Copied
TransactionSearchRequest request = new TransactionSearchRequest()
  .customerEmail().endsWith("example.com");

ResourceCollection<Transaction> collection = gateway.transaction().search(request);

Billing address

Java
Copy
Copied
TransactionSearchRequest request = new TransactionSearchRequest()
  .billingFirstName().is("Paul")
  .billingLastName().is("Smith")
  .billingCompany().is("Braintree")
  .billingStreetAddress().is("123 Main St")
  .billingExtendedAddress().is("Suite 123")
  .billingLocality().is("Chicago")
  .billingRegion().is("Illinois")
  .billingPostalCode().is("12345")
  .billingCountryName().is("United States of America");

ResourceCollection<Transaction> collection = gateway.transaction().search(request);

Shipping address

Java
Copy
Copied
TransactionSearchRequest request = new TransactionSearchRequest()
  .shippingFirstName().is("Paul")
  .shippingLastName().is("Smith")
  .shippingCompany().is("Braintree")
  .shippingStreetAddress().is("123 Main St")
  .shippingExtendedAddress().is("Suite 123")
  .shippingLocality().is("Chicago")
  .shippingRegion().is("Illinois")
  .shippingPostalCode().is("12345")
  .shippingCountryName().is("United States of America");

ResourceCollection<Transaction> collection = gateway.transaction().search(request);

Other top-level attributes

Java
Copy
Copied
TransactionSearchRequest request = new TransactionSearchRequest()
  .orderId().is("myorder")
  .processorAuthorizationCode().is("123456");

ResourceCollection<Transaction> collection = gateway.transaction().search(request);

Vault associations

You can search for transactions associated to a payment method token.

Java
Copy
Copied
TransactionSearchRequest request = new TransactionSearchRequest()
  .paymentMethodToken().is("the_token");

ResourceCollection<Transaction> collection = gateway.transaction().search(request);

How the transaction was created

You can search for transactions that were created using a token.

Java
Copy
Copied
TransactionSearchRequest request = new TransactionSearchRequest()
  .createdUsing().is(Transaction.CreatedUsing.TOKEN);

ResourceCollection<Transaction> collection = gateway.transaction().search(request);

Or transactions that were created using full credit card information.

Java
Copy
Copied
TransactionSearchRequest request = new TransactionSearchRequest()
  .createdUsing().is(Transaction.CreatedUsing.FULL_INFORMATION);

ResourceCollection<Transaction> collection = gateway.transaction().search(request);

Those are the only two choices for created_using.

Customer location

Customers in the US.

Java
Copy
Copied
TransactionSearchRequest request = new TransactionSearchRequest()
  .creditCardCustomerLocation().is(CreditCard.CustomerLocation.US);

ResourceCollection<Transaction> collection = gateway.transaction().search(request);

Or international customers.

Java
Copy
Copied
TransactionSearchRequest request = new TransactionSearchRequest()
  .creditCardCustomerLocation().is(CreditCard.CustomerLocation.INTERNATIONAL);

ResourceCollection<Transaction> collection = gateway.transaction().search(request);

Merchant account

A specific one.

Java
Copy
Copied
TransactionSearchRequest request = new TransactionSearchRequest();
var request = new TransactionSearchRequest()
  .creditCardCustomerLocation.is(CreditCardCustomerLocation.INTERNATIONAL);

ResourceCollection<Transaction> collection = gateway.Transaction.Search(request)
  .merchantAccountId().is("the_merchant_account_id");

ResourceCollection<Transaction> collection = gateway.transaction().search(request);

Or any of several.

Java
Copy
Copied
TransactionSearchRequest request = new TransactionSearchRequest()
  .merchantAccountId().in("account_1", "account_2");

ResourceCollection<Transaction> collection = gateway.transaction().search(request);

Credit card type

A specific one.

Java
Copy
Copied
TransactionSearchRequest request = new TransactionSearchRequest()
  .creditCardCardType().is(CreditCard.CardType.VISA);

ResourceCollection<Transaction> collection = gateway.transaction().search(request);

Or any of several.

Java
Copy
Copied
TransactionSearchRequest request = new TransactionSearchRequest()
  .creditCardCardType().in(
    CreditCard.CardType.VISA, CreditCard.CardType.MASTER_CARD, CreditCard.CardType.DISCOVER
  );

ResourceCollection<Transaction> collection = gateway.transaction().search(request);

Transaction status

Another one or many search field.

Java
Copy
Copied
TransactionSearchRequest request = new TransactionSearchRequest()
  .status().is(Transaction.Status.AUTHORIZED);

TransactionSearchRequest request = new TransactionSearchRequest()
  .status().in(
    Transaction.Status.AUTHORIZED, Transaction.Status.SUBMITTED_FOR_SETTLEMENT
  );

ResourceCollection<Transaction> collection = gateway.transaction().search(request);

Transaction source

API, Control Panel, or Recurring Billing.

Java
Copy
Copied
TransactionSearchRequest request = new TransactionSearchRequest()
  .source().is(Transaction.Source.API);

TransactionSearchRequest request = new TransactionSearchRequest()
  .source().in(
    Transaction.Source.API, Transaction.Source.CONTROL_PANEL
  );

ResourceCollection<Transaction> collection = gateway.transaction().search(request);

Transaction type

The two types of transactions are sale and credit. Refunds are a special kind of credit, so there are some extra options around them.

Java
Copy
Copied
TransactionSearchRequest request = new TransactionSearchRequest()
  .type().is(Transaction.Type.SALE);

ResourceCollection<Transaction> collection = gateway.transaction().search(request);

This will return all credits, regardless of whether they're refunds, or standalone credits.

Java
Copy
Copied
TransactionSearchRequest request = new TransactionSearchRequest()
  .type().is(Transaction.Type.CREDIT);

ResourceCollection<Transaction> collection = gateway.transaction().search(request);

If you only want the refunds:

Java
Copy
Copied
TransactionSearchRequest request = new TransactionSearchRequest()
  .type().is(Transaction.Type.CREDIT)
  .refund().is(true);

ResourceCollection<Transaction> collection = gateway.transaction().search(request);

And if you only want the credits that aren't refunds:

Java
Copy
Copied
TransactionSearchRequest request = new TransactionSearchRequest()
  .type().is(Transaction.Type.CREDIT)
  .refund().is(false);

ResourceCollection<Transaction> collection = gateway.transaction().search(request);

Amount

It's a range field.

Java
Copy
Copied
TransactionSearchRequest request = new TransactionSearchRequest()
  .amount().between(new BigDecimal("100.00"), new BigDecimal("200.00"));

TransactionSearchRequest request = new TransactionSearchRequest()
  .amount().greaterThanOrEqualTo(new BigDecimal("100.00"));

TransactionSearchRequest request = new TransactionSearchRequest()
  .amount().lessThanOrEqualTo(new BigDecimal("200.00"));

ResourceCollection<Transaction> collection = gateway.transaction().search(request);

Status changes

You can search for transactions that entered a given status at a certain date and time. For instance, you can find all transactions which were submitted for settlement in the past 3 days.

You can search on these statuses:

  • createdAt
  • authorizedAt
  • submittedForSettlementAt
  • settledAt
  • voidedAt
  • processorDeclinedAt
  • gatewayRejectedAt
  • failedAt
  • authorizationExpiredAt

A few examples:

Java
Copy
Copied
TransactionSearchRequest searchRequest = new TransactionSearchRequest()
  .createdAt().lessThanOrEqual(Calendar.getInstance());

ResourceCollection<Transaction> collection = gateway.transaction().search(searchRequest);
Java
Copy
Copied
TransactionSearchRequest searchRequest = new TransactionSearchRequest()
  .settledAt().lessThanOrEqual(Calendar.getInstance());

ResourceCollection<Transaction> collection = gateway.transaction().search(searchRequest);
Java
Copy
Copied
TransactionSearchRequest searchRequest = new TransactionSearchRequest()
  .processorDeclinedAt().lessThanOrEqual(Calendar.getInstance());

ResourceCollection<Transaction> collection = gateway.transaction().search(searchRequest);

Dispute date range

Java
Copy
Copied
TransactionSearchRequest searchRequest = new TransactionSearchRequest()
  .disputeDate().lessThanOrEqual(Calendar.getInstance());

ResourceCollection<Transaction> collection = gateway.transaction().search(searchRequest);
note

Time zones specified in the time value will be respected in the search; if you do not specify a time zone, the search will default to the time zone associated with your gateway account. Results will always be returned with time values in UTC.

See also

Still have questions?

If you can’t find an answer, contact us