public IActionResult Create(CreateStripeAccountViewModel model) { if (model.userEmail == null) { return BadRequest("User email cannot be empty"); } try { StripeConfiguration.ApiKey = "sk_test_51HvkPWGZgacNuBfZVUQCM2e3KO5iuMqwmIKnqujztMX0UvbkCyFJWhccLBPjKXxck92QwyMiVun9s7AS6zie6uFs00XbjswQBt"; var options = new AccountCreateOptions { Type = "express", }; var service = new AccountService(); var account = service.Create(options); var optionsLink = new AccountLinkCreateOptions { Account = account.Id, RefreshUrl = "https://makeaquiz.azurewebsites.net/somethingWentWrong", ReturnUrl = "https://makeaquiz.azurewebsites.net/createFullQuiz", Type = "account_onboarding", }; var serviceAccount = new AccountLinkService(); var accountLink = serviceAccount.Create(optionsLink); if (accountLink != null) { var responseFromGet = _stripeService.GetByEmail(model.userEmail); if (responseFromGet.DTO != null) { var newDTO = responseFromGet.DTO; newDTO.StripeAccountId = account.Id; var response = _stripeService.Update(newDTO); if (response.DidError) { return BadRequest(); } return Ok(accountLink.Url.ToString()); } else { var response = _stripeService.Create(new StripeAccountDTO { StripeAccountId = account.Id, UserEmail = model.userEmail }); if (response.DidError) { return BadRequest(); } return Ok(accountLink.Url.ToString()); } } else { return BadRequest(); } } catch (Exception ex) { return BadRequest(ex.Message); } }
public string CreateConnectedExpressAccount() { StripeConfiguration.ApiKey = "sk_test_xx"; //Stripe secret key var options = new AccountCreateOptions { Type = "express", }; var service = new AccountService(); var account = service.Create(options); var linkOptions = new AccountLinkCreateOptions { Account = account.Id, RefreshUrl = "https://example.com/reauth", ReturnUrl = "https://example.com/return", Type = "account_onboarding", }; var linkService = new AccountLinkService(); //user should redirect to this link and complete onboarding process var accountLink = linkService.Create(linkOptions); return(account.Id);//this is connectedStripeAccountId }
public async Task AddStripeCustomer(string email) { var userData = await _userRepository.FindByName(email); if (userData != null) { var professional = _userRepository.GetProfessionalFormById(userData.Id).Result; if (professional != null && string.IsNullOrEmpty(professional.StripeAccountId)) { var options = new AccountCreateOptions { Email = email, Type = "express", Capabilities = new AccountCapabilitiesOptions { CardPayments = new AccountCapabilitiesCardPaymentsOptions { Requested = true }, Transfers = new AccountCapabilitiesTransfersOptions { Requested = true }, } }; var service = new AccountService(); var customer = service.Create(options); await _userRepository.AddStripAccountId(userData.Id, customer.Id); } } }
public virtual async Task <Account> Create(AccountCreateOptions createOptions) { var postData = this.ApplyAllParameters(createOptions, string.Empty, false); //remove the ? postData = RemoveQuestionMark(postData); var response = await Requestor.Post(Urls.Accounts, data : postData); return(Mapper <Account> .MapFromJson(response)); }
public async Task <Account> CreateAccountAsync(string email) { var options = new AccountCreateOptions { Type = "express", Email = email }; var service = new AccountService(); return(await service.CreateAsync(options)); }
public string createAnAccount() { StripeConfiguration.ApiKey = "sk_test_51H4bEIAVJDEhYcbP8AniC54IhmNxi8AOAkQpTgSCdwJjXwd8eoYEZmpBdZPOn7mpkBhQWkuzYYIFUv1y8Y3ncnKO008t1vsMSK"; var option = new AccountCreateOptions { Type = "express" }; var service = new AccountService(); var account = service.Create(option); return(account.Id); }
public void SerializeEmptyAdditionalOwnersProperly() { var options = new AccountCreateOptions { LegalEntity = new AccountLegalEntityOptions { AdditionalOwners = new List <AccountAdditionalOwner>() }, }; var url = this.service.ApplyAllParameters(options, string.Empty, false); Assert.Equal("?legal_entity[additional_owners]=", url); }
public void Serialize() { var options = new AccountCreateOptions { Individual = new PersonCreateOptions { FirstName = "first name", LastName = "last name", }, }; Assert.Equal( "individual[first_name]=first+name&individual[last_name]=last+name", FormEncoder.CreateQueryString(options)); }
public async Task <string> CreateMerchant(string email) { var client = CreateClient(); var service = new AccountService(client); var options = new AccountCreateOptions { Type = "standard", Email = email, }; var account = await service.CreateAsync(options); return(account.Id); }
public void Serialize() { var options = new AccountCreateOptions { Individual = new PersonCreateOptions { FirstName = "first name", LastName = "last name", }, }; var url = this.service.ApplyAllParameters(options, string.Empty, false); Assert.Equal("?individual[first_name]=first+name&individual[last_name]=last+name", url); }
public string CreateConnectedCustomAccount() { StripeConfiguration.ApiKey = "sk_test_xx"; //Stripe secret key var options = new AccountCreateOptions { Type = "custom", Country = "US", Capabilities = new AccountCapabilitiesOptions { CardPayments = new AccountCapabilitiesCardPaymentsOptions { Requested = true, }, Transfers = new AccountCapabilitiesTransfersOptions { Requested = true, }, }, ExternalAccount = new AccountBankAccountOptions() { AccountHolderName = "abcd", AccountHolderType = "individual", AccountNumber = "000123456789", Country = "US", Currency = "usd", RoutingNumber = "110000000" }, BusinessType = "individual", Email = "*****@*****.**" }; var service = new AccountService(); var account = service.Create(options); return(account.Id);//this is connectedStripeAccountId }
public IActionResult Register([FromBody] UserModel model) { // map model to entity var user = _mapper.Map <User>(model); try { var options = new AccountCreateOptions { Type = "standard", }; var service = new AccountService(); Account account = service.Create(options); if (account != null && !string.IsNullOrWhiteSpace(account.Id)) { user.AccountId = account.Id; // create user _userService.Create(user, model.Password); } else { // return error message if there was an exception return(BadRequest(new { message = "Unable to create a payment account for the user!" })); } return(Ok()); } catch (Exception ex) { // return error message if there was an exception return(BadRequest(new { message = ex.Message })); } }
public void CreateAccount(string firstName, string lastName, string email) { StripeConfiguration.ApiKey = secretkey; var options = new TokenCreateOptions { BankAccount = new BankAccountOptions { Country = "CA", Currency = "cad", AccountHolderName = $"{firstName} {lastName}", AccountHolderType = "individual", RoutingNumber = "11000-000", AccountNumber = "000123456789" } }; var service = new TokenService(); var stripeToken = service.Create(options); Console.WriteLine("------------------------------------------------------------------"); Console.WriteLine($"Bank token: {stripeToken.Id}"); //create account var accountOptions = new AccountCreateOptions { Type = "custom", Country = "CA", DefaultCurrency = "cad", Individual = new PersonCreateOptions { Address = new AddressOptions { City = "Cumberland", Line1 = "1 Cumberland Square", PostalCode = "K4C", State = "Ontario" }, FirstName = firstName, LastName = lastName, Dob = new DobOptions { Year = 1989, Month = 1, Day = 1 }, IdNumber = "123456789",//SIN Email = email }, Email = email, TosAcceptance = new AccountTosAcceptanceOptions { Date = DateTime.Now, Ip = stripeToken.ClientIp }, BusinessType = "individual", Settings = new AccountSettingsOptions { Payouts = new AccountSettingsPayoutsOptions { DebitNegativeBalances = true, Schedule = new AccountSettingsPayoutsScheduleOptions { Interval = "daily" } } }, RequestedCapabilities = new List <string> { "card_payments", "transfers", }, }; var accountService = new AccountService(); var account = accountService.Create(accountOptions); Console.WriteLine("------------------------------------------------------------------"); Console.WriteLine($"Account: {account.Id}"); //create external account var externalOption = new ExternalAccountCreateOptions { ExternalAccount = stripeToken.Id, DefaultForCurrency = true }; var externalAccountService = new ExternalAccountService(); var externalAccount = externalAccountService.Create(account.Id, externalOption); Console.WriteLine("------------------------------------------------------------------"); Console.WriteLine($"External Account: {externalAccount.Id}"); }
public void SerializeAdditionalOwnersProperly() { var options = new AccountCreateOptions { LegalEntity = new AccountLegalEntityOptions { AdditionalOwners = new List <AccountAdditionalOwner> { new AccountAdditionalOwner { Dob = new AccountDobOptions { Day = 1, Month = 1, Year = 1980, }, FirstName = "John", LastName = "Doe", Verification = new AccountVerificationOptions { DocumentBackId = "file_234", DocumentId = "file_123", }, }, new AccountAdditionalOwner { Address = new AddressOptions { State = "CA", City = "City", Line1 = "Line1", Line2 = "Line2", PostalCode = "90210", Country = "US", }, FirstName = "Jenny", LastName = "Rosen", } }, }, }; var url = this.service.ApplyAllParameters(options, string.Empty, false); Assert.Equal( "?legal_entity[additional_owners][0][dob][day]=1" + "&legal_entity[additional_owners][0][dob][month]=1" + "&legal_entity[additional_owners][0][dob][year]=1980" + "&legal_entity[additional_owners][0][first_name]=John" + "&legal_entity[additional_owners][0][last_name]=Doe" + "&legal_entity[additional_owners][0][verification][document_back]=file_234" + "&legal_entity[additional_owners][0][verification][document]=file_123" + "&legal_entity[additional_owners][1][address][city]=City" + "&legal_entity[additional_owners][1][address][country]=US" + "&legal_entity[additional_owners][1][address][line1]=Line1" + "&legal_entity[additional_owners][1][address][line2]=Line2" + "&legal_entity[additional_owners][1][address][postal_code]=90210" + "&legal_entity[additional_owners][1][address][state]=CA" + "&legal_entity[additional_owners][1][first_name]=Jenny" + "&legal_entity[additional_owners][1][last_name]=Rosen", url); }
public static string CreateConnectedAccount(BillingInfoModel model, Models.User.UserInfoModel userDetail) { //var stripeKey = StripeApiKey(); var stripeKey = StripeApiKey(); var options = new AccountCreateOptions { Type = "custom", BusinessProfile = new AccountBusinessProfileOptions { Url = "http://viralad.tourtech.co.il/", Name = "affiliate", Mcc = "7311" }, Capabilities = new AccountCapabilitiesOptions { CardPayments = new AccountCapabilitiesCardPaymentsOptions { Requested = true, }, Transfers = new AccountCapabilitiesTransfersOptions { Requested = true, }, }, ExternalAccount = new AccountBankAccountOptions() { AccountHolderName = model.AccountHolderName, AccountHolderType = "individual", AccountNumber = model.AccountNumber, Country = "US", Currency = "usd", RoutingNumber = model.RoutingNumber, }, BusinessType = "individual", Email = userDetail.Email, Individual = new AccountIndividualOptions() { FirstName = userDetail.FirstName, LastName = userDetail.LastName, Dob = new DobOptions() //test d0b 1901-01-01 { Day = 1, //long.Parse(userDetail.DateOfBirth.Day.ToString()), Month = 1, //long.Parse(userDetail.DateOfBirth.Month.ToString()), Year = 1901 //long.Parse(userDetail.DateOfBirth.Year.ToString()) }, SsnLast4 = model.SsnLast4, IdNumber = model.IdNumber, Phone = "000 000 0000",//userDetail.Phone, Address = new AddressOptions { State = "Alabama", Country = "us", City = "Moody", Line1 = "address_full_match", PostalCode = "35004" }, Email = userDetail.Email }, TosAcceptance = new AccountTosAcceptanceOptions { Date = DateTime.UtcNow, Ip = "127.0.0.1", // provide request's IP address }, }; var service = new AccountService(); var account = service.Create(options); return(account.Id);//this is connectedStripeAccountId }
public async Task <Member> CreateStripeAccountOnPlatform(Member Member, string BusinessName) { var accountOptions = new AccountCreateOptions() { Email = Member.Email, Type = AccountType.Custom, Country = "US", BusinessType = "individual", RequestedCapabilities = new List <string>() { "platform_payments" }, Individual = new PersonCreateOptions { FirstName = Member.FirstName, LastName = Member.LastName, IdNumber = Member.SSNum, Email = Member.Email, Address = new AddressOptions() { City = Member.City, Line1 = Member.AddrLine, Line2 = Member.AddrLine2 ?? string.Empty, PostalCode = Member.Zip, State = Member.State, Country = "US" }, Dob = new DobOptions { Day = Member.BirthDay, Month = Member.BirthMonth, Year = Member.BirthYear }, }, BusinessProfile = new AccountBusinessProfileOptions { Name = BusinessName, Url = "https://simple-market.com" }, TosAcceptance = new AccountTosAcceptanceOptions { Date = Member.StripeTosDate, Ip = Member.StripeTosIp } }; var accountService = new AccountService(); Account account = await accountService.CreateAsync(accountOptions); if (account != null) { Member.StripeAccountId = account.Id; //Member.StripeRequestDate = account.StripeResponse.RequestDate; Member.StripeRequestId = account.StripeResponse.RequestId; // Stripe has removed this and asks for platform key // instead. 4.9.19 // Member.StripeAccountPubKey = account.Keys.Publishable; // Member.StripeAccountSecKey = account.Keys.Secret; } return(Member); }
/* public static bool ReceiveTransfer(string TransferID) * * { * try * { * var service = new TransferService(); * service.Get(TransferID); * return true; * } * catch(Exception ex) * { * Console.WriteLine(ex.Message); * throw ex; * } * } */ public static string makeAccount(User currUser, stripeAccountInfo accountInfo) { StripeConfiguration.ApiKey = privateKey; int nameIndex = currUser.name.IndexOf(' '); try { var options = new AccountCreateOptions { Type = "custom", Country = "US", Capabilities = new AccountCapabilitiesOptions { CardPayments = new AccountCapabilitiesCardPaymentsOptions { Requested = true, }, Transfers = new AccountCapabilitiesTransfersOptions { Requested = true, }, }, ExternalAccount = new AccountCardOptions { Cvc = accountInfo.cardInfo.SecurityCode, Currency = "usd", Name = accountInfo.cardInfo.CardName, Number = accountInfo.cardInfo.CardNumber, ExpMonth = accountInfo.cardInfo.ExpMonth, ExpYear = accountInfo.cardInfo.ExpYear }, BusinessType = "individual", Individual = new AccountIndividualOptions { FirstName = currUser.name.Substring(0, nameIndex), LastName = currUser.name.Substring(nameIndex + 1, (currUser.name.Length - (nameIndex + 1))), Dob = accountInfo.dob, SsnLast4 = accountInfo.lastFourSSN, Phone = accountInfo.phoneNumber, Address = new AddressOptions { City = accountInfo.address.City, Country = "US", Line1 = accountInfo.address.Line1, PostalCode = accountInfo.address.PostalCode, State = accountInfo.address.State }, Email = currUser.email }, TosAcceptance = new AccountTosAcceptanceOptions { Ip = getMyIP(), Date = DateTime.Now, }, BusinessProfile = new AccountBusinessProfileOptions { Mcc = "8299", //education services Url = "https://www.ufl.edu/", SupportUrl = "https://www.ufl.edu/" } }; var service = new AccountService(); var account = service.Create(options); return(account.Id); } catch (Exception ex) { Console.WriteLine(ex.Message); return(String.Empty); throw ex; } }
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); } }
// Creates a Stripe account using user information private Account CreateAccount(User user) { // account create options var options = new AccountCreateOptions() { BusinessType = "individual", TosAcceptance = new AccountTosAcceptanceOptions() { Date = DateTime.Now, Ip = "127.0.0.1" }, BusinessProfile = new AccountBusinessProfileOptions() { Mcc = "7991", Url = "http://www.harrisonbarker.co.uk" }, Individual = new AccountIndividualOptions() { FirstName = user.FirstName, LastName = user.LastName, Dob = new DobOptions() { Year = user.DateOfBirth.Year, Month = user.DateOfBirth.Month, Day = user.DateOfBirth.Day }, Address = new AddressOptions() { Line1 = user.Address.AddressLine1, Line2 = user.Address.AddressLine2, City = user.Address.City, Country = user.Address.CountryCode, PostalCode = user.Address.PostalCode }, Email = user.Email, Phone = user.PhoneNumber }, Capabilities = new AccountCapabilitiesOptions { CardPayments = new AccountCapabilitiesCardPaymentsOptions { Requested = true }, Transfers = new AccountCapabilitiesTransfersOptions { Requested = true }, }, Type = "custom" }; var service = new AccountService(); try { // requests account create from the Stripe api var account = service.Create(options); return(account); } catch (Exception e) { Logger.LogWarning(e.Message); throw; } }
public async void RegisterUser(Object sender, EventArgs e) { try { string firstNameVar = firstName.Text; string lastNameVar = lastName.Text; int dobDayVar = Convert.ToInt32(dobDay.Text); int dobMonthVar = Convert.ToInt32(dobMonth.Text); int dobYearVar = Convert.ToInt32(dobYear.Text); string addressLine1Var = addressLine1.Text; string addressLine2Var = addressLine2.Text; string postalCodeVar = postalCode.Text; var statesPickerVar = statesPicker.Items[statesPicker.SelectedIndex]; string routingNumberVar = routingNumber.Text; string accountNumberVar = accountNumber.Text; string cityVar = city.Text; StripeConfiguration.SetApiKey("sk_test_Q5wSnyXL03yN0KpPaAMYttOb"); //-------Get IP Address---------// var MyIp = ""; string uploadId = ""; foreach (IPAddress adress in Dns.GetHostAddresses(Dns.GetHostName())) { MyIp = adress.ToString(); break; } //------Camera will Open User take the Picture Of Idenity Card-----------// /* var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions * { * Directory = "Sample", * Name = "test.jpg", * PhotoSize = Plugin.Media.Abstractions.PhotoSize.Small * * }); * * //-------Upload File in stripe and return the file Id -------------// * using (FileStream stream = System.IO.File.Open(file.Path, FileMode.Open)) * { * var fileService = new FileService(); * var fileCreateOptions = new FileCreateOptions * { * File = stream, * Purpose = "identity_document", * }; * Stripe.File upload = fileService.Create(fileCreateOptions); * uploadId = upload.Id; * } */ //------Set File.id-----/// AccountVerificationOptions verifiy = new AccountVerificationOptions { DocumentId = uploadId, }; //--------Create User Account Legal Entity-----------// AccountLegalEntityOptions legalEntity = new AccountLegalEntityOptions { FirstName = firstNameVar, LastName = lastNameVar, Address = new AddressOptions { City = cityVar, Country = "AU", PostalCode = postalCodeVar, Line1 = addressLine1Var, Line2 = addressLine2Var, State = statesPickerVar }, Dob = new AccountDobOptions { Day = dobDayVar, Month = dobMonthVar, Year = dobYearVar }, Type = "individual", Verification = verifiy, PhoneNumber = "+611234567"//Convert.ToString(Xamarin.Forms.Application.Current.Properties["phoneNumber"]) }; //--------Create Payout Account-----------// var options = new AccountCreateOptions { Email = "*****@*****.**", Type = AccountType.Custom, Country = "AU", LegalEntity = legalEntity }; var services = new AccountService(); Account account = services.Create(options); //---------Create External Bank Account and return Token---------/// TokenCreateOptions optionss = new TokenCreateOptions { BankAccount = new BankAccountOptions { Country = "AU", AccountNumber = accountNumberVar, RoutingNumber = routingNumberVar, Currency = "aud" } }; TokenService service = new TokenService(); Token stripeToken = service.Create(optionss); var externalOption = new ExternalAccountCreateOptions { ExternalAccountTokenId = stripeToken.Id, //pass the bank account creation token }; var externalAccount = new ExternalAccountService(); var bankAccount = externalAccount.Create(account.Id, externalOption); //Bank Account Created // await DisplayAlert("", "" + account.Id, "Ok"); //api.AcceptedStripeAgreement(account.Id,CurrentTimeMillis(), MyIp); //Accepted Stripe TOS await DisplayAlert("", "" + account.Id, "Ok"); }catch (Exception ex) { await DisplayAlert("", "" + ex, "Ok"); } }
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); } }
public AccountServiceTest() { this.service = new AccountService(); this.createOptions = new AccountCreateOptions { Type = AccountType.Custom, ExternalAccountId = "tok_visa_debit", LegalEntity = new AccountLegalEntityOptions { AdditionalOwners = new List <AccountAdditionalOwner> { new AccountAdditionalOwner { // Verified this is encoded properly but stripe-mock does not // support dob at the moment for additional owners. // Dob = new AccountDobOptions // { // Day = 1, // Month = 1, // Year = 1980, // }, FirstName = "John", LastName = "Doe", Verification = new AccountVerificationOptions { DocumentBackId = "file_123", DocumentId = "file_234", }, }, new AccountAdditionalOwner { Address = new AddressOptions { State = "CA", City = "City", Line1 = "Line1", Line2 = "Line2", PostalCode = "90210", Country = "US", }, FirstName = "Jenny", LastName = "Rosen", } }, Verification = new AccountVerificationOptions { DocumentBackId = "file_abc", DocumentId = "file_bcd", }, } }; this.updateOptions = new AccountUpdateOptions { Metadata = new Dictionary <string, string> { { "key", "value" }, }, }; this.rejectOptions = new AccountRejectOptions { Reason = "terms_of_service" }; this.listOptions = new AccountListOptions { Limit = 1, }; }
public AccountServiceTest( StripeMockFixture stripeMockFixture, MockHttpClientFixture mockHttpClientFixture) : base(stripeMockFixture, mockHttpClientFixture) { this.service = new AccountService(this.StripeClient); this.createOptions = new AccountCreateOptions { Type = AccountType.Custom, BusinessProfile = new AccountBusinessProfileOptions { Name = "business name", }, BusinessType = "company", Capabilities = new AccountCapabilitiesOptions { CardPayments = new AccountCapabilitiesCardPaymentsOptions { Requested = true, }, Transfers = new AccountCapabilitiesTransfersOptions { Requested = true, }, }, Company = new AccountCompanyOptions { Address = new AddressOptions { State = "CA", City = "City", Line1 = "Line1", Line2 = "Line2", PostalCode = "90210", Country = "US", }, Name = "Company name", Verification = new AccountCompanyVerificationOptions { Document = new AccountCompanyVerificationDocumentOptions { Back = "file_back", Front = "file_front", }, }, }, ExternalAccount = "tok_visa_debit", Settings = new AccountSettingsOptions { Branding = new AccountSettingsBrandingOptions { Logo = "file_123", }, CardPayments = new AccountSettingsCardPaymentsOptions { DeclineOn = new AccountSettingsCardPaymentsDeclineOnOptions { AvsFailure = true, CvcFailure = true, }, StatementDescriptorPrefix = "STR", }, Payments = new AccountSettingsPaymentsOptions { StatementDescriptor = "STRIPE 123", }, Payouts = new AccountSettingsPayoutsOptions { DebitNegativeBalances = true, Schedule = new AccountSettingsPayoutsScheduleOptions { Interval = "monthly", MonthlyAnchor = "10", }, }, }, TosAcceptance = new AccountTosAcceptanceOptions { Date = DateTime.Parse("Mon, 01 Jan 2001 00:00:00Z"), Ip = "127.0.0.1", UserAgent = "User-Agent", }, }; this.updateOptions = new AccountUpdateOptions { Metadata = new Dictionary <string, string> { { "key", "value" }, }, }; this.rejectOptions = new AccountRejectOptions { Reason = "terms_of_service", }; this.listOptions = new AccountListOptions { Limit = 1, }; }
public static void InitializeDbForTests(ApplicationContext context, AppSettings appSettings) { StripeConfiguration.ApiKey = appSettings.StripeApiKey; PasswordHasher <User> hasher = new PasswordHasher <User>( new OptionsWrapper <PasswordHasherOptions>( new PasswordHasherOptions { CompatibilityMode = PasswordHasherCompatibilityMode.IdentityV2 }) ); context.AddRange(Categories); User.Password = hasher.HashPassword(User, "Password"); var customerCreateOptions = new CustomerCreateOptions() { Email = User.Email, Phone = User.PhoneNumber, Name = User.FirstName + " " + User.LastName }; var customerService = new CustomerService(); var customer = customerService.Create(customerCreateOptions); User.StripeCustomerId = customer.Id; var accountCreateOptions = new AccountCreateOptions() { BusinessType = "individual", TosAcceptance = new AccountTosAcceptanceOptions() { Date = DateTime.Now, Ip = "127.0.0.1" }, BusinessProfile = new AccountBusinessProfileOptions() { Mcc = "7991", Url = "http://www.harrisonbarker.co.uk" }, Individual = new AccountIndividualOptions() { FirstName = User.FirstName, LastName = User.LastName, Dob = new DobOptions() { Year = User.DateOfBirth.Year, Month = User.DateOfBirth.Month, Day = User.DateOfBirth.Day }, Address = new AddressOptions() { Line1 = User.Address.AddressLine1, Line2 = User.Address.AddressLine2, City = User.Address.City, Country = User.Address.CountryCode, PostalCode = User.Address.PostalCode }, Email = User.Email, Phone = User.PhoneNumber }, Capabilities = new AccountCapabilitiesOptions { CardPayments = new AccountCapabilitiesCardPaymentsOptions { Requested = true }, Transfers = new AccountCapabilitiesTransfersOptions { Requested = true }, }, Type = "custom" }; var accountService = new AccountService(); var account = accountService.Create(accountCreateOptions); User.StripeAccountId = account.Id; context.Add(User); context.Add(Event); context.SaveChanges(); }