Skip to content

Instantly share code, notes, and snippets.

@deepumi
Last active May 23, 2017 19:52
Show Gist options
  • Select an option

  • Save deepumi/5332141b5390f1217ab86ba2e0dcdf59 to your computer and use it in GitHub Desktop.

Select an option

Save deepumi/5332141b5390f1217ab86ba2e0dcdf59 to your computer and use it in GitHub Desktop.
Stripe account creation
public static void Main()
{
var account = new StripeAccount
{
Email = "[email protected]",
Managed = false,
StripeExternalAccount = new StripeExternalAccount
{
AccountNumber = "000123456789",
RoutingNumber = "110000000",
AccountHolderName = "DEEPU 1",
AccountHolderType = "individual",
},
StripeLegalEntity = new StripeLegalEntity
{
StripeAddress = new StripeAddress
{
AddressLine1 = "123234 Add1",
City = "Reston",
State = "VA",
ZipCode = "20190"
},
BusinessName = "My business",
StripeAccountHolderDateOfBirth = new StripeAccountHolderDateOfBirth
{
BirthDay = 25,
BirthYear = 1981,
BirthMonth = 4
},
Type = "individual",
FirstName = "Deepu",
LastName = "Madhu",
SsnLast4Provided = true,
SsnLast4 = "2343"
}
};
var dict = new Dictionary<string, string>
{
{"country", account.Country},
{"email", account.Email},
{"managed", "false"},
{"external_account", JsonConvert.SerializeObject(account.StripeExternalAccount)},
{"legal_entity", JsonConvert.SerializeObject(account.StripeLegalEntity) },
{"default_currency", account.DefaultCurrency }
};
var result = stripe.Send(HttpMethod.Post, "https://api.stripe.com/v1/accounts", new FormUrlEncodedContent(dict));
}
public class StripeAccount
{
[JsonProperty("country")]
public string Country { get; set; } = "US";
[JsonProperty("email")]
public string Email { get; set; }
[JsonProperty("managed")]
public bool Managed { get; set; }
[JsonProperty("external_account")]
public StripeExternalAccount StripeExternalAccount { get; set; }
[JsonProperty("legal_entity")]
public StripeLegalEntity StripeLegalEntity { get; set; }
[JsonProperty("default_currency")]
public string DefaultCurrency { get; set; } = "usd";
}
public class StripeAddress
{
[JsonProperty("line1")]
public string AddressLine1 { get; set; }
[JsonProperty("line2")]
public string AddressLine2 { get; set; }
[JsonProperty("city")]
public string City { get; set; }
[JsonProperty("state")]
public string State { get; set; }
[JsonProperty("postal_code")]
public string ZipCode { get; set; }
[JsonProperty("country")]
public string Country { get; set; } = "US";
}
public class StripeAccountHolderDateOfBirth
{
[JsonProperty("day")]
public int? BirthDay { get; set; }
[JsonProperty("month")]
public int? BirthMonth { get; set; }
[JsonProperty("year")]
public int? BirthYear { get; set; }
}
public class StripeLegalEntity
{
[JsonProperty("address")]
public StripeAddress StripeAddress { get; set; }
[JsonProperty("business_name")]
public string BusinessName { get; set; }
[JsonProperty("business_tax_id_provided")]
public bool BusinessTaxIdProvided { get; set; }
[JsonProperty("dob")]
public StripeAccountHolderDateOfBirth StripeAccountHolderDateOfBirth { get; set; }
[JsonProperty("first_name")]
public string FirstName { get; set; }
[JsonProperty("last_name")]
public string LastName { get; set; }
[JsonProperty("personal_address")]
public StripeAddress PersonalAddress { get; set; }
[JsonProperty("personal_id_number_provided")]
public bool? PersonalIdNumberProvided { get; set; }
[JsonProperty("ssn_last_4_provided")]
public bool? SsnLast4Provided { get; set; }
[JsonProperty("type")]
public string Type { get; set; }
[JsonProperty("verification")]
public StripeVerificationBusiness Verification { get; set; }
[JsonProperty("ssn_last_4")]
public string SsnLast4 { get; set; }
}
public class StripeVerificationBusiness
{
[JsonProperty("verification")]
public string Details { get; set; }
[JsonProperty("details_code")]
public string DetailsCode { get; set; }
[JsonProperty("document")]
public string Document { get; set; }
[JsonProperty("status")]
public string Status { get; set; }
}
public class StripeExternalAccount
{
[JsonProperty("object")]
public string ObjectType { get; set; } = "bank_account";
[JsonProperty("account_number")]
public string AccountNumber { get; set; }
[JsonProperty("country")]
public string Country { get; set; } = "US";
[JsonProperty("currency")]
public string Currency { get; set; } = "usd";
[JsonProperty("account_holder_name")]
public string AccountHolderName { get; set; }
[JsonProperty("account_holder_type")]
public string AccountHolderType { get; set; }
[JsonProperty("routing_number")]
public string RoutingNumber { get; set; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment