public listing_sources_on_customer() { var sourceService = new StripeSourceService(Cache.ApiKey); var customerService = new StripeCustomerService(Cache.ApiKey); // Create customer var CustomerCreateOptions = new StripeCustomerCreateOptions { Email = "*****@*****.**", }; var Customer = customerService.Create(CustomerCreateOptions); // Create card source and attach it to customer var SourceCardCreateOptions = new StripeSourceCreateOptions { Type = StripeSourceType.Card, Token = "tok_visa" }; var SourceCard = sourceService.Create(SourceCardCreateOptions); var SourceAttachOptions = new StripeSourceAttachOptions { Source = SourceCard.Id }; SourceCard = sourceService.Attach(Customer.Id, SourceAttachOptions); // Create bitcoin source and attach it to customer var SourceBitcoinCreateOptions = new StripeSourceCreateOptions { Type = StripeSourceType.Bitcoin, Amount = 1000, Currency = "usd", Owner = new StripeSourceOwner { Email = "*****@*****.**", }, }; var SourceBitcoin = sourceService.Create(SourceBitcoinCreateOptions); SourceAttachOptions.Source = SourceBitcoin.Id; SourceBitcoin = sourceService.Attach(Customer.Id, SourceAttachOptions); // List sources on customer SourceListAll = sourceService.List(Customer.Id); var SourceListOptions = new StripeSourceListOptions { Type = StripeSourceType.Card }; SourceListCard = sourceService.List(Customer.Id, SourceListOptions); SourceListOptions.Type = StripeSourceType.Bitcoin; SourceListBitcoin = sourceService.List(Customer.Id, SourceListOptions); }
public listing_sources_on_customer() { var sourceService = new StripeSourceService(Cache.ApiKey); var customerService = new StripeCustomerService(Cache.ApiKey); // Create customer var CustomerCreateOptions = new StripeCustomerCreateOptions { Email = "*****@*****.**", }; var Customer = customerService.Create(CustomerCreateOptions); // Create card source and attach it to customer var SourceCardCreateOptions = new StripeSourceCreateOptions { Type = StripeSourceType.Card, Token = "tok_visa" }; var SourceCard = sourceService.Create(SourceCardCreateOptions); var SourceAttachOptions = new StripeSourceAttachOptions { Source = SourceCard.Id }; SourceCard = sourceService.Attach(Customer.Id, SourceAttachOptions); // Create ACH Credit Transfer source and attach it to customer var SourceACHCreditCreateOptions = new StripeSourceCreateOptions { Type = StripeSourceType.AchCreditTransfer, Currency = "usd", Owner = new StripeSourceOwner { Email = "*****@*****.**", }, }; var SourceACHCredit = sourceService.Create(SourceACHCreditCreateOptions); SourceAttachOptions.Source = SourceACHCredit.Id; SourceACHCredit = sourceService.Attach(Customer.Id, SourceAttachOptions); // List sources on customer SourceListAll = sourceService.List(Customer.Id); var SourceListOptions = new StripeSourceListOptions { Type = StripeSourceType.Card }; SourceListCard = sourceService.List(Customer.Id, SourceListOptions); SourceListOptions.Type = StripeSourceType.AchCreditTransfer; SourceListACHCredit = sourceService.List(Customer.Id, SourceListOptions); }