public async Task <List <string> > GetPayoutTransactionsAsync(string accountId, string payoutId) { var result = new List <string>(); var balanceTransactionService = new BalanceTransactionService(); var chargeService = new Stripe.ChargeService(); var transferService = new Stripe.TransferService(); var requestOptions = new RequestOptions { StripeAccount = accountId }; var transactions = await balanceTransactionService.ListAsync(new BalanceTransactionListOptions { Payout = payoutId, Type = "payment", Limit = 100 }, requestOptions); foreach (var transaction in transactions) { var payment = await chargeService.GetAsync(transaction.SourceId, null, requestOptions); var transfer = await transferService.GetAsync(payment.SourceTransferId); result.Add(transfer.SourceTransactionId); } return(result); }
public async Task <IEnumerable <BalanceTransaction> > GetBalanceHistoryFor(string VendorsSKey) { var service = new BalanceTransactionService(); var transactions = await service.ListAsync( new BalanceTransactionListOptions { Limit = 12, } ); return(transactions); // Don't know how with latest Stripe updates //var balanceService = new BalanceService(); //var opts= new RequestOptions() { ApiKey=VendorsSKey, StripeConnectAccountId=} //StripeList<BalanceTransaction> balanceTransactions = // await balanceService.GetAsync(opts, CancellationToken.None) //return balanceTransactions; }
public async Task <IActionResult> GetBalanceHistory([FromRoute] string userId) { try { StripeConfiguration.ApiKey = ServiceKey; var user = await _accountsRepository.GetByUserId(userId); var service = new BalanceTransactionService(); List <BalanceTransaction> transactions = (await service.ListAsync(new BalanceTransactionListOptions { }, new RequestOptions { StripeAccount = user.StripeUserId })).ToList(); return(Ok(transactions)); } catch (Exception e) { return(BadRequest(new MessageObj(e.Message))); } }