public StripeSourceServiceTest() { this.service = new StripeSourceService(); this.createOptions = new StripeSourceCreateOptions { Type = StripeSourceType.AchCreditTransfer, Currency = "usd", Mandate = new StripeSourceMandateOptions { MandateAcceptanceDate = DateTime.Parse("Mon, 01 Jan 2001 00:00:00Z"), MandateAcceptanceIp = "127.0.0.1", MandateAcceptanceStatus = "accepted", MandateAcceptanceUserAgent = "User-Agent", MandateNotificationMethod = "manual", }, Receiver = new StripeSourceReceiverOptions { RefundAttributesMethod = "manual", }, }; this.updateOptions = new StripeSourceUpdateOptions { Metadata = new Dictionary <string, string>() { { "key", "value" }, }, }; this.listOptions = new StripeSourceListOptions() { Limit = 1, }; }
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); }
static void GetBankAccountCharges(StripeChargeService chargeService, TraceWriter log) { string lastObjectId = null; DateTime?lastObjectCreated = null; StripeList <StripeCharge> response = null; var greaterThanCreatedFilter = GetLatestBankAccountChargeTime(); log.Info($"Max Back Account Charge Created Time: {greaterThanCreatedFilter}"); var listOptions = new StripeChargeListOptions() { Limit = 100, Created = new StripeDateFilter { LessThan = greaterThanCreatedFilter }, StartingAfter = lastObjectId }; var sourceListOptions = new StripeSourceListOptions() { Type = "Bank Account" }; do { response = chargeService.List(listOptions); foreach (var c in response.Data) { var trans = StripeChargeToStripeTransaction(c); UpsertStripeTransaction(trans, log); } lastObjectId = response.Data.LastOrDefault()?.Id; lastObjectCreated = response.Data.LastOrDefault()?.Created; listOptions.StartingAfter = lastObjectId; log.Info($"Charge last ObjectId: {lastObjectId}. Created Time: {lastObjectCreated}.More responses? {response.HasMore}"); }while (response.HasMore); }
public StripeSourceServiceTest() { this.service = new StripeSourceService(); this.createOptions = new StripeSourceCreateOptions { Type = StripeSourceType.AchCreditTransfer, Currency = "usd" }; this.updateOptions = new StripeSourceUpdateOptions { Metadata = new Dictionary <string, string>() { { "key", "value" }, }, }; this.listOptions = new StripeSourceListOptions() { Limit = 1, }; }