//Return money if session end Unsuccessfully public int UnSuccessfullySession(int SessionId) { IList <Operation> operations = PaymentDB.GetAllSessionOperations(SessionId, GetConfiguration().GetConnectionString(DEFAULT_CONNECTION)); foreach (Operation op in operations) { //If the payment was made via the card so refund it if (op.PaymentMethodId == LkpDetails["Card"]) { if (op.Captured == 1) { ApiRefundPayment(op.Id); } else { ApiVoidPayment(op.Id); } } //If the payment was made via OMT we need to refund it //If the payment was made via Paypal we need to refund it } int response = PaymentDB.ReturnPayments(SessionId, GetConfiguration().GetConnectionString(DEFAULT_CONNECTION)); return(response); }