public creating_and_updating_invoices_with_manual_invoicing()
        {
            var customerService    = new StripeCustomerService(Cache.ApiKey);
            var invoiceItemService = new StripeInvoiceItemService(Cache.ApiKey);
            var invoiceService     = new StripeInvoiceService(Cache.ApiKey);

            var CustomerCreateOptions = new StripeCustomerCreateOptions
            {
                Email = "*****@*****.**",
            };
            var Customer = customerService.Create(CustomerCreateOptions);

            var InvoiceItemCreateOptions = new StripeInvoiceItemCreateOptions
            {
                Amount     = 1000,
                Currency   = "usd",
                CustomerId = Customer.Id
            };
            var InvoiceItem = invoiceItemService.Create(InvoiceItemCreateOptions);

            var InvoiceCreateOptions = new StripeInvoiceCreateOptions
            {
                Billing      = StripeBilling.SendInvoice,
                DaysUntilDue = 7,
            };

            InvoiceCreated = invoiceService.Create(Customer.Id, InvoiceCreateOptions);

            var InvoiceUpdateOptions = new StripeInvoiceUpdateOptions
            {
                Paid = true,
            };

            InvoiceUpdated = invoiceService.Update(InvoiceCreated.Id, InvoiceUpdateOptions);
        }
        public StripeInvoiceServiceTest()
        {
            this.service = new StripeInvoiceService();

            this.createOptions = new StripeInvoiceCreateOptions()
            {
                TaxPercent = 12.5m,
            };

            this.updateOptions = new StripeInvoiceUpdateOptions()
            {
                Metadata = new Dictionary <string, string>()
                {
                    { "key", "value" },
                },
            };

            this.listOptions = new StripeInvoiceListOptions()
            {
                Limit = 1,
            };

            this.listLineItemsOptions = new StripeInvoiceListLineItemsOptions()
            {
                Limit = 1,
            };

            this.upcomingOptions = new StripeUpcomingInvoiceOptions()
            {
                SubscriptionId = "sub_123",
            };
        }
Пример #3
0
        public static async Task <string> UpdateInvoice(string invoiceId)
        {
            StripeConfiguration.SetApiKey("sk_test_5nCTR2UZmnOPWgZASvirbYDy");

            StripeInvoiceUpdateOptions invoiceOptions = new StripeInvoiceUpdateOptions()
            {
                Closed = false
            };

            StripeInvoiceService invoiceService = new StripeInvoiceService();
            //"in_1D18zxHWpLOEdy24Tgw0TzEq"
            //             |
            //             V
            StripeInvoice invoice = await invoiceService.UpdateAsync(invoiceId, invoiceOptions);

            return("OK");
        }