コード例 #1
0
 public StripeCustomerGateway(IBillingConfig config)
 {
     customerService      = new Stripe.CustomerService();
     subscriptionService  = new Stripe.SubscriptionService();
     paymentMethodService = new Stripe.PaymentMethodService();
     this.config          = config;
 }
コード例 #2
0
ファイル: Program.cs プロジェクト: karlitros/Cashier
        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);
                }
            }
        }
コード例 #3
0
        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));
        }
コード例 #4
0
        public async Task <PaymentMethod> DetachPaymentMethodAsync(string paymentMethodId)
        {
            var service = new Stripe.PaymentMethodService();

            return(await service.DetachAsync(paymentMethodId));
        }