Submitting Transaction for Settlement

The only thing you need to submit a transaction for settlement is the transaction ID.

Result<Transaction> result = gateway.Transaction.SubmitForSettlement("the_transaction_id");

Partial Amount

If you only want to settle a portion of the total authorization amount, you can specify the amount to settle. If you do not specify, the entire amount will be settled. You cannot settle more than the authorized amount.

Result<Transaction> result = gateway.Transaction.Refund("the_transaction_id", Decimal.Parse("35.00"));

Checking the Result

If the transaction is successfully submitted for settlement, result.success? will return true. Otherwise, check for validation errors.

if (result.IsSuccess())
{
    // transaction successfully submitted for settlement
}
else
{
    foreach (ValidationError error in result.Errors.DeepAll())
    {
        Console.WriteLine(error.Message);
    }
}

Validations

Oops

If you submit a transaction for settlement and then decide you actually don’t want to settle it, you can void it before it’s settled. After it’s settled, you’ll need to refund it. To check if the transaction has been settled, find the transaction and check the status.

Transaction transaction = gateway.Transaction.Find("the_transaction_id");

if (transaction.Status == TransactionStatus.SUBMITTED_FOR_SETTLEMENT)
{
    // can void
}
else if (transaction.Status == TransactionStatus.SETTLED)
{
    // will have to refund it
}
else
{
    // this example only expected one of the two above statuses
}

See Also