Search code examples
rubypayment-gatewaypaymentcredit-cardbraintree

Order of transactions returned by Braintree API


When retrieving the transactions for a Braintree::Customer, the ResourceCollection returned seems to be ordered by decreasing created_at. Is it safe to assume this will always be the case?

If one wanted a different order, could that be specified via the the optional options hash parameter? Is there documentation of what can be provided as options?


Solution

  • I work at Braintree. If you want more detailed help than we can give on Stack Overflow, please get in touch with our support team.

    Yes, they'll always be returned in that order. Unfortunately, this doesn't appear to be documented under customer details, possibly because the transactions method isn't supported in all of our client libraries. We'll check it out and add it to our docs if possible -- thanks for bringing it to our attention.

    The options parameter is not actually used; it is left over from the original, non-threadsafe version of the library for backwards compatibility reasons.

    If you want a subset of transactions, you can use transaction search, but when getting the transactions from the customer object, they will always be sorted by created_at.