private async System.Threading.Tasks.Task levantar() { try { string emailPaypal = txt_emaillevantar.Text; double valor = double.Parse(txt_moneylevantar.Text.Replace(".", ",")); if (emailPaypal == String.Empty || emailPaypal.Contains("@") == false || emailPaypal.Contains(".") == false) { throw new Exception("O email indicado não é válido."); } if (valor <= 0) { throw new Exception("Valor indicado inválido"); } int id_user = int.Parse(Session["id_user"].ToString()); Models.User user = new User(id_user); double saldo = user.getSaldo(); if (saldo - valor < 0) { throw new Exception("O seu saldo não permite executar esta ação!"); } var body = new CreatePayoutRequest() { SenderBatchHeader = new SenderBatchHeader() { EmailMessage = $"O teu levantamento foi sucedido, recebeste {valor}", EmailSubject = "Recebeste dinheiro da Food4U!!" }, Items = new List <PayoutItem>() { new PayoutItem() { RecipientType = "EMAIL", Amount = new Currency() { CurrencyCode = "EUR", Value = valor.ToString().Replace(",", "."), }, Receiver = emailPaypal, } } }; PayoutsPostRequest request = new PayoutsPostRequest(); request.RequestBody(body); Transacao.LevantarDinheiro(id_user, saldo, valor); var response = await CreatePayout.client().Execute(request); var result = response.Result <CreatePayoutResponse>(); Debug.WriteLine("Status: {0}", result.BatchHeader.BatchStatus); Debug.WriteLine("Batch Id: {0}", result.BatchHeader.PayoutBatchId); Debug.WriteLine("Links:"); foreach (LinkDescription link in result.Links) { Debug.WriteLine("\t{0}: {1}\tCall Type: {2}", link.Rel, link.Href, link.Method); } } catch (Exception erro) { ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "MostrarNotificação", $"ShowNotification('Erro','{erro.Message}', 'error')", true); } }