Пример #1
0
        public TransferServiceTest(
            StripeMockFixture stripeMockFixture,
            MockHttpClientFixture mockHttpClientFixture)
            : base(stripeMockFixture, mockHttpClientFixture)
        {
            this.service = new TransferService(this.StripeClient);

            this.createOptions = new TransferCreateOptions
            {
                Amount      = 123,
                Currency    = "usd",
                Destination = "acct_123",
            };

            this.updateOptions = new TransferUpdateOptions
            {
                Metadata = new Dictionary <string, string>
                {
                    { "key", "value" },
                },
            };

            this.listOptions = new TransferListOptions
            {
                Limit = 1,
            };
        }
        public async Task <string> TransferQuickOrderFeeFromStore(string storestripeAccId, string quickOrderFee, string storeId)
        {
            try
            {
                var key = await _context.Stores.Where(s => s.StoreId.ToString() == storeId).FirstOrDefaultAsync();

                //StripeConfiguration.ApiKey = this._configuration.GetSection("Stripe")["SecretKey"];
                StripeConfiguration.ApiKey = key.SKKey;
                string totalfee = quickOrderFee.Replace(".", "");

                var options = new TransferCreateOptions
                {
                    Amount      = long.Parse(totalfee),
                    Currency    = "usd",
                    Destination = "acct_1HDvl5BahC5Vu88T",
                    Description = "Order Fee Quick Order",
                };
                var service       = new TransferService();
                var transfertoken = await service.CreateAsync(options);

                if (!string.IsNullOrEmpty(transfertoken.Id))
                {
                    return(transfertoken.Id);
                }
                else
                {
                    return(string.Empty);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(string.Empty);
            }
        }
Пример #3
0
        public static bool CreateTransfer(double paymentAmount, string stripeAccountID)
        {
            //Convert to cents, find percentage after percent fee and standard 30 cent fee
            paymentAmount = ((paymentAmount * 100) * .971) - 30; //payout amount AFTER stripe fee

            try
            {
                StripeConfiguration.ApiKey = privateKey;
                var options = new TransferCreateOptions
                {
                    Amount      = (long)(paymentAmount),
                    Currency    = "USD",
                    Description = "transfer sucess",
                    Destination = stripeAccountID
                };
                var      service    = new TransferService();
                Transfer TransferId = service.Create(options);
                return(true);
            }

            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                throw ex;
            }
        }
        public async Task <IActionResult> Transfer([FromBody] TransferCreationDto transferCreationDto)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(new { message = ModelState.Values.SelectMany(v => v.Errors).Select(e => e.ErrorMessage) }));
            }

            try
            {
                StripeConfiguration.ApiKey = ServiceKey;

                // The sender is usually the employer and the freelancer the receiver.
                //This is just to expose a generic interface
                var senderAccount = await _accountsRepository.GetByUserId(transferCreationDto.SenderId);

                var receiverAccount = await _accountsRepository.GetByUserId(transferCreationDto.ReceiverId);

                var service = new TransferService();
                var options = new TransferCreateOptions
                {
                    Amount      = transferCreationDto.Amount,
                    Currency    = "usd",
                    Destination = receiverAccount.StripeUserId
                };
                var transfer = service.Create(options, new RequestOptions {
                    StripeAccount = senderAccount.StripeUserId
                });

                return(Ok());
            }
            catch (Exception e)
            {
                return(BadRequest(new MessageObj(e.Message)));
            }
        }
Пример #5
0
        public async Task StripeConnectTransfersControllerApi()
        {
            _logger.Log(LogCategory.Debug, "Starting job");
            try
            {
                //start job here.
                var currenyList = await _querySender.Send(new CurrencyTypesQuery { });

                var queryResults = await _querySender.Send(new TransactionStripeConnectTransfersQuery { TransferDate = DateTime.Today });

                foreach (TransactionStripeConnectTransfer transactionStripeConnectTransfer in queryResults.transactionStripeConnectTransfers)
                {
                    var currency = currenyList.currencyTypes.Where(x => x.Id == transactionStripeConnectTransfer.CurrencyId).First().Code;
                    if (currency.ToUpper() == "AUD" || currency.ToUpper() == "USD")
                    {
                        _logger.Log(LogCategory.Debug, "starting transfer for " + transactionStripeConnectTransfer.Id.ToString());
                        // Create a PaymentIntent:
                        Transfer transfer = new Transfer();
                        try
                        {
                            var transferService = new TransferService();
                            var transferOption  = new TransferCreateOptions
                            {
                                Amount            = (long)(transactionStripeConnectTransfer.Amount),
                                Currency          = currenyList.currencyTypes.Where(x => x.Id == transactionStripeConnectTransfer.CurrencyId).First().Code,
                                Destination       = transactionStripeConnectTransfer.StripeConnectedAccount,
                                SourceTransaction = transactionStripeConnectTransfer.SourceTransactionChargeId
                            };

                            var apiKey = _settings.GetConfigSetting(FIL.Configuration.Utilities.SettingKeys.PaymentGateway.Stripe.SecretKey).Value;
                            if (currency.ToUpper() == "AUD")
                            {
                                apiKey = _settings.GetConfigSetting(FIL.Configuration.Utilities.SettingKeys.PaymentGateway.Stripe.FeelAustralia.SecretKey).Value;
                            }
                            transfer = transferService.Create(transferOption, new RequestOptions
                            {
                                ApiKey = apiKey
                            });
                            _logger.Log(LogCategory.Debug, "transfer completed for " + transactionStripeConnectTransfer.Id.ToString());
                            await _commandSender.Send <TransactionStripeConnectTransfersCommand>(new TransactionStripeConnectTransfersCommand { Id = transactionStripeConnectTransfer.Id, TransferApiResponse = transfer.ToString(), TransferDateActual = DateTime.Today });
                        }
                        catch (Exception ex)
                        {
                            _logger.Log(LogCategory.Error, ex);
                            await _commandSender.Send <TransactionStripeConnectTransfersCommand>(new TransactionStripeConnectTransfersCommand { Id = transactionStripeConnectTransfer.Id, TransferApiResponse = ex.ToString(), TransferDateActual = DateTime.Today });
                        }
                    }
                    else
                    {
                        await _commandSender.Send <TransactionStripeConnectTransfersCommand>(new TransactionStripeConnectTransfersCommand { Id = transactionStripeConnectTransfer.Id, TransferApiResponse = "cross region account.", TransferDateActual = DateTime.Today });
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.Log(LogCategory.Error, ex);
            }
            _logger.Log(LogCategory.Debug, "Finishing Job.");
        }
Пример #6
0
        public virtual async Task <Transfer> Create(TransferCreateOptions options)
        {
            var url = this.ApplyAllParameters(options, Urls.Transfers, false);

            var response = await Requestor.Post(url);

            return(Mapper <Transfer> .MapFromJson(response));
        }
Пример #7
0
        public Transfer TransferFromSmToVendor(SmChargeInfo vm)
        {
            var options = new TransferCreateOptions
            {
                Amount            = (vm.TotalAmount - vm.SmFee),
                Currency          = "usd",
                Destination       = vm.VendorStripeAcctId,
                SourceTransaction = vm.ChargeId
            };

            var service = new TransferService();

            return(service.Create(options));
        }
Пример #8
0
        public void Payout(int bookingId, string accountId, double amount)
        {
            StripeConfiguration.ApiKey = secretkey;
            var transferService = new TransferService();
            var option          = new TransferCreateOptions
            {
                Amount        = long.Parse((amount * 100).ToString()),
                Currency      = "cad",
                Destination   = accountId,
                Description   = $"Payout for booking #{bookingId}",
                TransferGroup = $"Booking #{bookingId}"
            };

            var transfer = transferService.Create(option);

            Console.WriteLine("------------------------------------------------------------------");
            Console.WriteLine($"transfer: {JsonConvert.SerializeObject(transfer)}");
        }
        //for stripe account to stripe account payment
        public IActionResult TrannsferPayment(string connectedStripeAccountId)
        {
            StripeConfiguration.ApiKey = "sk_test_xx"; //Stripe secret key
            var options = new TransferCreateOptions
            {
                Amount   = 10,
                Currency = "usd",
                //Destination = "acct_1HqgwvCwt0Ou4Dgi", //for test standard account
                //Destination = "acct_1HqwkrQ2LNYZDMiV",  //for test custom account
                Destination = "acct_1HqwrqQ7aXzmziE6",  //for test custom account

                //Destination = connectedStripeAccountId
            };

            var service  = new TransferService();
            var Transfer = service.Create(options);

            return(Json(new { Transfer.StripeResponse }));
        }
        //public static string MakePayment(string amount, string type, string currency)
        //{
        //    StripeApiKey();
        //    var paymentAmount = long.Parse(amount);
        //    var options = new PaymentIntentCreateOptions
        //    {
        //        Amount = paymentAmount * 100,
        //        Currency = currency,//"usd",
        //        PaymentMethodTypes = new List<string>
        //        {
        //           type,// "card",
        //        },
        //    };
        //    var service = new PaymentIntentService();
        //    var payment = service.Create(options);
        //    return payment.Id;
        //}
        public static string MakePayment(long amount, string stripeId)
        {
            try
            {
                StripeApiKey();
                var options = new TransferCreateOptions
                {
                    Amount      = amount * 100,
                    Currency    = "usd",
                    Destination = stripeId,
                };

                var service  = new TransferService();
                var Transfer = service.Create(options);
                return(Transfer.Id);
            }
            catch (StripeException ex)
            {
                throw ex;
            }
        }
Пример #11
0
        public TransferServiceTest()
        {
            this.service = new TransferService();

            this.createOptions = new TransferCreateOptions
            {
                Amount      = 123,
                Currency    = "usd",
                Destination = "acct_123",
            };

            this.updateOptions = new TransferUpdateOptions
            {
                Metadata = new Dictionary <string, string>
                {
                    { "key", "value" },
                },
            };

            this.listOptions = new TransferListOptions
            {
                Limit = 1,
            };
        }
Пример #12
0
        private Transfer TransferCharge(string chargeId, string accountId)
        {
            StripeConfiguration.ApiKey = _appKeys.StripeApiKey;

            var chargeService = new ChargeService();
            var charge        = chargeService.Get(chargeId);

            long   chargeAmount = charge.Amount;
            double fee          = chargeAmount * .05; // collecting a 5% for charge
            long   amountFee    = Convert.ToInt64(fee);

            var options = new TransferCreateOptions
            {
                Amount            = chargeAmount - amountFee,
                Currency          = "usd",
                SourceTransaction = chargeId,
                Destination       = accountId,
                Description       = "Appointment transfer",
            };
            var transferService = new TransferService();
            var transfer        = transferService.Create(options);

            return(transfer);
        }
Пример #13
0
        public async Task <int> PaymentCredit(string token, int amount,
                                              string bank_account, string routing_number, string account_name)
        {
            try
            {
                long userId       = (long)Session["USER_ID"];
                user residentUser = entities.users.Find(userId);
                // Charge using Credit Card
                StripeConfiguration.SetApiKey(ep.GetStripeSecretKey());
                var chargeOptions = new ChargeCreateOptions
                {
                    Amount      = amount + 20000,
                    Currency    = "usd",
                    Description = "Charge for [email protected]",
                    SourceId    = token // obtained with Stripe.js,
                };
                var    chargeService = new ChargeService();
                Charge charge        = chargeService.Create(chargeOptions);
                // Payout to coamdin bank
                // Get Bank Info
                string bankAccountStr = bank_account;   //"000123456789";//
                string bankRoutingStr = routing_number; // "110000000";//

                // Get self account
                var accountOptions = new AccountCreateOptions
                {
                    Email               = "*****@*****.**",
                    Type                = AccountType.Custom,
                    Country             = "US",
                    ExternalBankAccount = new AccountBankAccountOptions()
                    {
                        Country           = "US",
                        Currency          = "usd",
                        AccountHolderName = "John Brown",//account_name
                        AccountHolderType = "individual",
                        RoutingNumber     = bankRoutingStr,
                        AccountNumber     = bankAccountStr
                    },
                    PayoutSchedule = new AccountPayoutScheduleOptions()
                    {
                        Interval = "daily"
                    },
                    TosAcceptance = new AccountTosAcceptanceOptions()
                    {
                        Date      = DateTime.Now.AddDays(-10),
                        Ip        = "202.47.115.80",
                        UserAgent = "Chrome"
                    },
                    LegalEntity = new AccountLegalEntityOptions()
                    {
                        Dob = new AccountDobOptions()
                        {
                            Day   = 1,
                            Month = 4,
                            Year  = 1991
                        },
                        FirstName = "John",
                        LastName  = "Brown",
                        Type      = "individual"
                    }
                };
                var     accountService = new AccountService();
                Account account        = await accountService.CreateAsync(accountOptions);

                StripeConfiguration.SetApiKey(ep.GetStripeSecretKey());

                var     service = new BalanceService();
                Balance balance = await service.GetAsync();

                var transOptions = new TransferCreateOptions
                {
                    Amount      = amount,
                    Currency    = "usd",
                    Destination = account.Id
                };

                var      transferService = new TransferService();
                Transfer Transfer        = transferService.Create(transOptions);

                var payoutOptions = new PayoutCreateOptions
                {
                    Amount              = amount,
                    Currency            = "usd",
                    Destination         = account.ExternalAccounts.First().Id,
                    SourceType          = "card",
                    StatementDescriptor = "PAYOUT",
                    //Method = "instant"
                };

                var requestOptions = new RequestOptions();
                requestOptions.ApiKey = ep.GetStripeSecretKey();
                requestOptions.StripeConnectAccountId = account.Id;
                var payoutService = new PayoutService();
                var payout        = await payoutService.CreateAsync(payoutOptions, requestOptions);

                return(1);
            }
            catch (Exception ex)
            {
                return(0);
            }
        }
Пример #14
0
        public async Task <int> PaymentAch(string bankToken, int amount,
                                           string account_number, string rounting_number)
        {
            try
            {
                // Create an ACH charge
                StripeConfiguration.SetApiKey(ep.GetStripeSecretKey());
                CustomerService customerService = new CustomerService();
                var             customerOptions = new CustomerCreateOptions
                {
                };
                Customer achCustomer = customerService.Create(customerOptions);

                // Create Bank Account
                var bankAccountOptions = new BankAccountCreateOptions
                {
                    SourceToken = bankToken
                };
                var         bankService = new BankAccountService();
                BankAccount bankAccount = bankService.Create(achCustomer.Id, bankAccountOptions);
                // Verify BankAccount
                List <long> Amounts = new List <long>();
                Amounts.Add(32);
                Amounts.Add(45);

                var verifyOptions = new BankAccountVerifyOptions
                {
                    Amounts = Amounts
                };

                bankAccount = bankService.Verify(achCustomer.Id, bankAccount.Id, verifyOptions);
                var chargeOptions = new ChargeCreateOptions
                {
                    Amount      = amount,
                    Currency    = "usd",
                    Description = "Charge for [email protected]",
                    CustomerId  = achCustomer.Id
                };
                var    chargeService = new ChargeService();
                Charge charge        = chargeService.Create(chargeOptions);
                // Payout from Stripe to Bank Account
                string bankAccountStr = account_number;  // "000123456789";
                string bankRoutingStr = rounting_number; // "110000000";

                // Get self account
                var accountOptions = new AccountCreateOptions
                {
                    Email               = "*****@*****.**",
                    Type                = AccountType.Custom,
                    Country             = "US",
                    ExternalBankAccount = new AccountBankAccountOptions()
                    {
                        Country           = "US",
                        Currency          = "usd",
                        AccountHolderName = "John Brown",//account_name
                        AccountHolderType = "individual",
                        RoutingNumber     = bankRoutingStr,
                        AccountNumber     = bankAccountStr
                    },
                    PayoutSchedule = new AccountPayoutScheduleOptions()
                    {
                        Interval = "daily"
                    },
                    TosAcceptance = new AccountTosAcceptanceOptions()
                    {
                        Date      = DateTime.Now.AddDays(-10),
                        Ip        = "202.47.115.80",
                        UserAgent = "Chrome"
                    },
                    LegalEntity = new AccountLegalEntityOptions()
                    {
                        Dob = new AccountDobOptions()
                        {
                            Day   = 1,
                            Month = 4,
                            Year  = 1991
                        },
                        FirstName = "John",
                        LastName  = "Brown",
                        Type      = "individual"
                    }
                };
                var     accountService = new AccountService();
                Account account        = await accountService.CreateAsync(accountOptions);

                StripeConfiguration.SetApiKey(ep.GetStripeSecretKey());

                var     service = new BalanceService();
                Balance balance = await service.GetAsync();

                var transOptions = new TransferCreateOptions
                {
                    Amount      = amount,
                    Currency    = "usd",
                    Destination = account.Id
                };

                var      transferService = new TransferService();
                Transfer Transfer        = transferService.Create(transOptions);

                var payoutOptions = new PayoutCreateOptions
                {
                    Amount              = amount,
                    Currency            = "usd",
                    Destination         = account.ExternalAccounts.First().Id,
                    SourceType          = "card",
                    StatementDescriptor = "PAYOUT",
                    //Method = "instant"
                };

                var requestOptions = new RequestOptions();
                requestOptions.ApiKey = ep.GetStripeSecretKey();
                requestOptions.StripeConnectAccountId = account.Id;
                var payoutService = new PayoutService();
                var payout        = await payoutService.CreateAsync(payoutOptions, requestOptions);

                return(1);
            }
            catch (Exception)
            {
                return(0);
            }
        }
Пример #15
0
        public string MakePayoutToCustomer(int TicketId, string username)
        {
            string staffId = _userRepository.Get(x => x.UserName == username).Id;

            //lấy all routeTicke ứng vs cái Ticket
            ///// CÁCH 1
            var route =
                (from ROUTE in _routeRepository.GetAllQueryable()

                 join RT in _routeTicketRepository.GetAllQueryable()
                 on ROUTE.Id equals RT.RouteId

                 where ROUTE.Deleted == false &&
                 RT.Deleted == false &&
                 ROUTE.Status == RouteStatus.Bought &&
                 RT.TicketId == TicketId

                 select ROUTE)
                .FirstOrDefault();

            if (route == null)
            {
                return("Not found Route");
            }
            var ticket = _ticketRepository.Get(x => x.Id == TicketId && x.Deleted == false);

            if (ticket.Status == TicketStatus.Completed)
            {
                throw new InvalidOperationException();
            }
            _unitOfWork.StartTransaction();
            ticket.Status = TicketStatus.Completed;
            _ticketRepository.Update(ticket);
            _unitOfWork.CommitChanges();

            //make payout
            var paymentDetail = _paymentRepository.Get(x => x.RouteId == route.Id && x.Deleted == false);

            StripeConfiguration.SetApiKey(SETTING.Value.SecretStripe);
            var amount = ticket.SellingPrice * (100 - ticket.CommissionPercent) / 100;

            //số tiền chuyển đi
            var options = new TransferCreateOptions
            {
                Amount            = Convert.ToInt64(amount * 100),
                Currency          = "usd",
                Destination       = ticket.Seller.StripeConnectAccountId,
                SourceTransaction = paymentDetail.StripeChargeId,
                Description       = "Transfer for Ticket Code: " + ticket.TicketCode
            };

            var      service  = new TransferService();
            Transfer Transfer = service.Create(options);

            Core.Models.Payout payoutCreateIntoDatabase = new Core.Models.Payout();
            payoutCreateIntoDatabase.StripePayoutId = Transfer.Id;
            payoutCreateIntoDatabase.TicketId       = TicketId;
            payoutCreateIntoDatabase.PaymentId      = paymentDetail.Id;
            payoutCreateIntoDatabase.Amount         = amount;
            payoutCreateIntoDatabase.FeeAmount      = ticket.SellingPrice * (ticket.CommissionPercent / 100);
            payoutCreateIntoDatabase.Description    = "You receive money for ticket " + ticket.TicketCode + ". Thank you for using our service.";
            payoutCreateIntoDatabase.Status         = PayoutStatus.Success;
            _payoutRepository.Add(payoutCreateIntoDatabase);

            //make payout

            //save log
            //_unitOfWork.StartTransaction();
            ResolveOptionLog log = new ResolveOptionLog()
            {
                Option   = ResolveOption.PAYOUT,
                RouteId  = route.Id,
                TicketId = TicketId,
                StaffId  = staffId,
                Amount   = amount
            };

            _resolveOptionLogRepository.Add(log);
            _unitOfWork.CommitChanges();

            if (route.ResolveOptionLogs.Count() == route.RouteTickets.Where(x => x.Deleted == false).Count())
            {
                route.Status = RouteStatus.Completed;
                _routeRepository.Update(route);
            }
            _unitOfWork.CommitTransaction();
            //save log

            //push noti to buyer
            var message = "Ticket " + ticket.TicketCode + " has been payout. $" +
                          (amount).ToString("N2") + " has been tranfered to your Stripe account.";
            var           sellerDevices   = ticket.Seller.CustomerDevices.Where(x => x.IsLogout == false);
            List <string> sellerDeviceIds = new List <string>();

            foreach (var sellerDev in sellerDevices)
            {
                sellerDeviceIds.Add(sellerDev.DeviceId);
            }
            //push noti
            _oneSignalService.PushNotificationCustomer(message, sellerDeviceIds);

            //Save Notification
            _notificationService.SaveNotification(
                customerId: ticket.SellerId,
                type: NotificationType.TicketIsPayouted,
                message: $"Ticket {ticket.TicketCode} has been payout. ${(amount).ToString("N2")} has been transfered to your Stripe account.",
                data: new { ticketId = ticket.Id, });

            //send Email
            _sendGridService.SendEmailReceiptForSeller(TicketId, amount);

            return("");
        }
Пример #16
0
        public PaymentIntentCreateOptions StripePaymentIntentCreateOptions(IStripeCharge stripeChargeParameters, string apiKey, ref List <TransferCreateOptions> transferOptions)
        {
            IEnumerable <StripeConnectMaster> stripeConnectMaster = GetMasterData(stripeChargeParameters.TransactionId);
            var chargeOptions = new PaymentIntentCreateOptions();

            if (stripeChargeParameters.ChannelId != Channels.Feel)
            {
                long applicationFeeAmount = 0;
                if (stripeConnectMaster != null && stripeConnectMaster.Any())
                {
                    applicationFeeAmount = (long)((stripeConnectMaster.FirstOrDefault().ServiceCharge + stripeConnectMaster.FirstOrDefault().DeliveryCharges + stripeConnectMaster.FirstOrDefault().ConvenienceCharges) * 100);
                }
                if (stripeConnectMaster != null && stripeConnectMaster.Any() && stripeConnectMaster.FirstOrDefault().IsEnabled&& applicationFeeAmount != 0)
                {
                    chargeOptions = new PaymentIntentCreateOptions
                    {
                        PaymentMethodId     = stripeChargeParameters.Token,
                        Amount              = Convert.ToInt32(Convert.ToDouble(stripeChargeParameters.Amount) * 100),
                        Currency            = stripeChargeParameters.Currency.ToString().ToLower(),
                        Description         = "Transaction charge for " + stripeChargeParameters.TransactionId.ToString(),
                        Confirm             = true,
                        ConfirmationMethod  = "manual",
                        StatementDescriptor = stripeChargeParameters.ChannelId == Channels.Feel ? "FEELAPLACE.COM" : "ZOONGA.COM"
                    };
                    if (applicationFeeAmount > 0)
                    {
                        var transferOption = new TransferCreateOptions
                        {
                            Amount      = (long)(applicationFeeAmount),
                            Currency    = stripeChargeParameters.Currency,
                            Destination = stripeConnectMaster.FirstOrDefault().StripeConnectAccountID,
                            ExtraParams = new Dictionary <string, object>()
                            {
                                { "EndDateTime", stripeConnectMaster.FirstOrDefault().EndDateTime.AddDays(stripeConnectMaster.FirstOrDefault().PayoutDaysOffset) }, { "CreatedBy", stripeConnectMaster.FirstOrDefault().CreatedBy }
                            }
                        };
                        transferOptions.Add(transferOption);
                    }
                    return(chargeOptions);
                }
            }

            if (stripeChargeParameters.ChannelId == Channels.Feel)
            {
                int chargeCount = 0;
                if (stripeConnectMaster.Count() > 0 && stripeConnectMaster.Where(x => x.IsEnabled == true).Any())
                {
                    chargeOptions = new PaymentIntentCreateOptions
                    {
                        PaymentMethodId     = stripeChargeParameters.Token,
                        Amount              = Convert.ToInt32(Convert.ToDouble(stripeChargeParameters.Amount) * 100),
                        Currency            = stripeChargeParameters.Currency.ToString().ToLower(),
                        Description         = "Transaction charge for " + stripeChargeParameters.TransactionId.ToString(),
                        Confirm             = true,
                        ConfirmationMethod  = "manual",
                        StatementDescriptor = stripeChargeParameters.ChannelId == Channels.Feel ? "FEELAPLACE.COM" : "ZOONGA.COM"
                    };

                    foreach (StripeConnectMaster stripeConnectMasterRow in stripeConnectMaster)
                    {
                        if (stripeConnectMasterRow.IsEnabled)
                        {
                            // Create a Transfer to the connected account for releasing ticket amount (minus our commission):
                            decimal amount = stripeConnectMasterRow.TotalTickets * stripeConnectMasterRow.PricePerTicket * 100;
                            if (stripeConnectMasterRow.ExtraCommisionFlat > 0)
                            {
                                amount = amount - (stripeConnectMasterRow.ExtraCommisionFlat * stripeConnectMasterRow.TotalTickets * 100);
                            }
                            else if (stripeConnectMasterRow.ExtraCommisionPercentage > 0)
                            {
                                amount = amount - ((amount * stripeConnectMasterRow.ExtraCommisionPercentage) / 100);
                            }
                            chargeCount++;
                            if (amount > 0)
                            {
                                var transferOption = new TransferCreateOptions
                                {
                                    Amount      = (long)(amount),
                                    Currency    = stripeChargeParameters.Currency,
                                    Destination = stripeConnectMasterRow.StripeConnectAccountID,
                                    ExtraParams = new Dictionary <string, object>()
                                    {
                                        { "EndDateTime", stripeConnectMasterRow.EndDateTime.AddDays(stripeConnectMasterRow.PayoutDaysOffset) }, { "CreatedBy", stripeConnectMasterRow.CreatedBy }
                                    }
                                };
                                transferOptions.Add(transferOption);
                            }

                            // Create a Transfer to the connected account for chargeBack amount
                            amount = 0;
                            if (stripeConnectMasterRow.ChargebackHoldFlat > 0)
                            {
                                amount = stripeConnectMasterRow.ChargebackHoldFlat;
                            }
                            else if (stripeConnectMasterRow.ChargebackHoldPercentage > 0)
                            {
                                amount = stripeConnectMasterRow.TotalTickets * stripeConnectMasterRow.PricePerTicket * 100;
                                amount = (amount * stripeConnectMasterRow.ExtraCommisionPercentage) / 100;
                            }

                            if (amount > 0)
                            {
                                var transferOption = new TransferCreateOptions
                                {
                                    Amount      = (long)(amount),
                                    Currency    = stripeChargeParameters.Currency,
                                    Destination = stripeConnectMasterRow.StripeConnectAccountID,
                                    ExtraParams = new Dictionary <string, object>()
                                    {
                                        { "EndDateTime", stripeConnectMasterRow.EndDateTime.AddDays(stripeConnectMasterRow.ChargebackDaysOffset) }, { "CreatedBy", stripeConnectMasterRow.CreatedBy }
                                    }
                                };
                                transferOptions.Add(transferOption);
                            }
                        }
                    }
                    if (chargeCount > 0)
                    {
                        return(chargeOptions);
                    }
                }
            }

            chargeOptions = new PaymentIntentCreateOptions
            {
                PaymentMethodId     = stripeChargeParameters.Token,
                Amount              = Convert.ToInt32(Convert.ToDouble(stripeChargeParameters.Amount) * 100),
                Currency            = stripeChargeParameters.Currency.ToString().ToLower(),
                Description         = "Transaction charge for " + stripeChargeParameters.TransactionId.ToString(),
                Confirm             = true,
                ConfirmationMethod  = "manual",
                StatementDescriptor = stripeChargeParameters.ChannelId == Channels.Feel ? "FEELAPLACE.COM" : "ZOONGA.COM"
            };

            return(chargeOptions);
        }