Voiding Transactions
You can void transactions that have a status of authorized or submitted_for_settlement. All you need is the transaction ID. When the transaction is voided Braintree will do an authorization reversal if possible so that the customer won’t have a pending charge on their card.
Result<Transaction> result = gateway.Transaction.Void("the_transaction_id");
Checking the Result
If the transaction is successfully voided, result.success? will return true. Otherwise, check for validation errors.
if (result.IsSuccess())
{
// transaction successfully voided
}
else
{
foreach (ValidationError error in result.Errors.DeepAll())
{
Console.WriteLine(error.Message);
}
}
Validations
- To void a transaction, the status must be authorized or submitted for settlement.