public StripeCustomerGateway(IBillingConfig config) { customerService = new Stripe.CustomerService(); subscriptionService = new Stripe.SubscriptionService(); paymentMethodService = new Stripe.PaymentMethodService(); this.config = config; }
static void Main(string[] args) { RepoDb.SqlServerBootstrap.Initialize(); var repo = new PaymentIntentRepository(); var data = repo.GetAll(0, 3000); StripeConfiguration.ApiKey = ConfigurationManager.AppSettings["Cashier:Stripe:Secret"]; var chargeApi = new Stripe.ChargeService(); var charges = chargeApi.List(new ChargeListOptions { Limit = 5000 }); foreach (var item in data) { var paymentMethodApi = new Stripe.PaymentMethodService(); var paymentIntentApi = new Stripe.PaymentIntentService(); var invoiceApi = new Stripe.InvoiceService(); if (item.ExternalReference?.StartsWith("pi_") ?? true) { continue; } var payment = charges.FirstOrDefault(p => p.PaymentMethod == item.ExternalReference); if (payment != null && !string.IsNullOrEmpty(payment.PaymentIntentId)) { item.ExternalReference = payment.PaymentIntentId; repo.SavePaymentIntent(item); } } }
public async Task <StripeList <PaymentMethod> > GetPaymentMethodsAsync(string customerId) { var options = new Stripe.PaymentMethodListOptions { Customer = customerId, Type = "card", }; var service = new Stripe.PaymentMethodService(); return(await service.ListAsync(options)); }
public async Task <PaymentMethod> DetachPaymentMethodAsync(string paymentMethodId) { var service = new Stripe.PaymentMethodService(); return(await service.DetachAsync(paymentMethodId)); }