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); }
public attaching_and_detaching_sources() { var SourceCardCreateOptions = new StripeSourceCreateOptions { Type = StripeSourceType.Card, Token = "tok_visa" }; var CustomerCreateOptions = new StripeCustomerCreateOptions { Email = "*****@*****.**", }; var sourceService = new StripeSourceService(Cache.ApiKey); var customerService = new StripeCustomerService(Cache.ApiKey); var SourceCard = sourceService.Create(SourceCardCreateOptions); Customer = customerService.Create(CustomerCreateOptions); var SourceAttachOptions = new StripeSourceAttachOptions { Source = SourceCard.Id }; SourceAttached = sourceService.Attach(Customer.Id, SourceAttachOptions); SourceDetached = sourceService.Detach(Customer.Id, SourceAttached.Id); }
public creating_three_d_secure_source() { var sourceCreateOptions = new StripeSourceCreateOptions { Type = StripeSourceType.Card, Amount = 1234, Currency = "eur", RedirectReturnUrl = "http://no.where/webhooks", Card = new StripeCreditCardOptions { // Using PAN as we don't have a 3DS test token yet Number = "4000000000003063", ExpirationMonth = 12, ExpirationYear = 2020 } }; var threeDSCreateOptions = new StripeSourceCreateOptions { Type = StripeSourceType.ThreeDSecure, Amount = 8675309, Currency = "eur", RedirectReturnUrl = "http://no.where/webhooks", }; var sourceService = new StripeSourceService(Cache.ApiKey); var customerService = new StripeCustomerService(Cache.ApiKey); Customer = customerService.Create(new StripeCustomerCreateOptions { }); Source = sourceService.Create(sourceCreateOptions); threeDSCreateOptions.ThreeDSecureCardOrSourceId = Source.Id; ThreeDSecure = sourceService.Create(threeDSCreateOptions); SourceCustomer = sourceService.Create(sourceCreateOptions); var SourceAttachOptions = new StripeSourceAttachOptions { Source = SourceCustomer.Id }; sourceService.Attach(Customer.Id, SourceAttachOptions); threeDSCreateOptions.ThreeDSecureCardOrSourceId = SourceCustomer.Id; threeDSCreateOptions.ThreeDSecureCustomer = Customer.Id; ThreeDSecureCustomer = sourceService.Create(threeDSCreateOptions); // from here, you have to go to the threeDSecure.Redirect.Url and click success //var charge = new StripeChargeService(Cache.ApiKey).Create( // new StripeChargeCreateOptions // { // Amount = 8675309, // Currency = "eur", // SourceTokenOrExistingSourceId = threeDSecure.Id // } //); }