Exemple #1
0
        static void TestCreateInvoiceItems(StripePayment payment)
        {
            StripeCustomer        cust = payment.CreateCustomer(new StripeCustomerInfo());
            StripeInvoiceItemInfo info = GetInvoiceItemInfo();

            info.CustomerID = cust.ID;
            StripeInvoiceItem     item    = payment.CreateInvoiceItem(info);
            StripeInvoiceItemInfo newInfo = GetInvoiceItemInfo();

            newInfo.Description = "Invoice item: " + Guid.NewGuid().ToString();
            StripeInvoiceItem item2 = payment.UpdateInvoiceItem(item.ID, newInfo);
            StripeInvoiceItem item3 = payment.GetInvoiceItem(item2.ID);

            if (item.Description == item3.Description)
            {
                throw new Exception("Update failed");
            }
            StripeInvoiceItem deleted = payment.DeleteInvoiceItem(item2.ID);

            if (!deleted.Deleted.HasValue && deleted.Deleted.Value)
            {
                throw new Exception("Delete failed");
            }
            var items = payment.GetInvoiceItems(10, 10, null);

            Console.WriteLine(items.Total);
            payment.DeleteCustomer(cust.ID);
        }