Esempio n. 1
0
 private static Stripe.StripeCustomer GetCustomers(string id)
 {
     Stripe.StripeCustomerService customerService = new Stripe.StripeCustomerService();
     customerService.ApiKey = ConfigHelper.GetStripeApiKey();
     Stripe.StripeCustomer customer = customerService.Get(id);
     return(customer);
 }
        public ActionResult Customer(string id)
        {
            SetCustomerId(id);

            Stripe.StripeCustomerService customerService = new Stripe.StripeCustomerService();
            customerService.ApiKey = ConfigHelper.GetStripeApiKey();
            Stripe.StripeCustomer customer = customerService.Get(id);


            //Stripe.StripeInvoiceService invoiceService=new Stripe.StripeInvoiceService();
            //invoiceService.ApiKey="sk_test_TMvswfMKVJpGk3K1WJ4jGyGL";
            //List<Stripe.StripeInvoice> stripeInvoices = invoiceService.List(new Stripe.StripeInvoiceListOptions { CustomerId = id }).ToList();

            Stripe.StripeInvoiceItemService invoiceItemService = new Stripe.StripeInvoiceItemService();
            invoiceItemService.ApiKey = ConfigHelper.GetStripeApiKey();
            List <Stripe.StripeInvoiceLineItem> invoices = invoiceItemService.List(new Stripe.StripeInvoiceItemListOptions {
                CustomerId = id
            }).ToList();

            MeteredInvoiceViewModel viewModel = new MeteredInvoiceViewModel();

            viewModel.Invoices   = invoices;
            viewModel.AzureUsage = GetAzureDataUsage();
            viewModel.AzureUsage.StripeCustomerId = id;
            return(View(viewModel));
        }