Braintree provides a pretty massive list of different statuses to a transaction. Without hardcoding a massive list of statuses (that might change in the future), is there a recommended way to know if a Braintree::Transaction
is successful?
I got the following response from Braintree support:
A successful transaction will go through the following statuses: Authorized > Submitted for Settlement > Settling > Settled. If you're aiming to only show successful transactions my recommendation would be to only pull transactions with a status of Settled. Once a transaction has reached the Settled status it will never change. However, transactions with a status of Submitted for Settlement or Settling, while rare, could potentially be declined or return an error during the settlement process.
In my code I chose to do the following:
def is_braintree_status_successful?(braintree_transaction)
%w(authorized submitted_for_settlement settling settled).include?(braintree_transaction.status)
end