Refunding Transactions

A transaction can be refunded if its status is settled or settling. If the transaction has not yet begun settlement, it should be voided instead of refunded.

Full Refund

If you do not specify an amount to refund, the entire transaction amount will be refunded.

transaction = braintree.Transaction.find("the_transaction_id")
result = braintree.Transaction.refund(transaction.id)

result.is_success
# True

result.transaction.type
# "credit"

result.transaction.id
# e.g. "mtpw3x"

Partial Refund

If you only want to refund a portion of the transaction, you can specify the amount to refund. We also support multiple partial refunds. You can continue to refund a transaction as many times as you like so long as the sum of the refund amounts is less than the amount of the initial transaction. If you have already partially refunded a transaction, performing another refund without specifying the balance it will create a refund for the remaining non-refunded amount of the transaction.

result = braintree.Transaction.refund("the_transaction_id", "50.00")
result.is_success
# True
result.transaction.type
# "credit"
result.transaction.amount
# "50.00"

result = braintree.Transaction.refund("the_transaction_id", "10.00")
result.is_success
# True
result.transaction.type
# "credit"
result.transaction.amount
# "10.00"

Validations

See Also