Beispiel #1
0
 private static void TestInvoices(StripePayment payment)
 {
     List<StripeInvoice> invoices = payment.GetInvoices(10, 10);
     StripeInvoice inv = payment.GetInvoice(invoices[0].Id);
     StripeCustomer cust = payment.CreateCustomer(new StripeCustomerInfo());
     StripeSubscription sub = payment.Subscribe(cust.Id, new StripeSubscriptionInfo { Card = GetCC() });
     StripeInvoice inv2 = payment.GetUpcomingInvoice(cust.Id);
     payment.Unsubscribe(cust.Id, true);
     payment.DeleteCustomer(cust.Id);
 }
Beispiel #2
0
        private static void TestInvoices2(StripePayment payment)
        {
            StripeCustomer cust = payment.GetCustomer("cus_ulcOcy5Seu2dpq");
            StripePlanInfo planInfo = new StripePlanInfo
                {
                    Amount = 1999,
                    Id = "testplan",
                    Interval = StripePlanInterval.month,
                    Name = "The Test Plan",
                    //TrialPeriod = 7
                };
            //payment.DeletePlan (planInfo.Id);
            StripePlan plan = payment.CreatePlan(planInfo);
            StripeSubscriptionInfo subInfo = new StripeSubscriptionInfo
                { Card = GetCC(), Plan = planInfo.Id, Prorate = true };
            StripeSubscription sub = payment.Subscribe(cust.Id, subInfo);
            payment.CreateInvoiceItem(
                new StripeInvoiceItemInfo { CustomerId = cust.Id, Amount = 1337, Description = "Test single charge" });

            int total;
            List<StripeInvoice> invoices = payment.GetInvoices(0, 10, cust.Id, out total);
            StripeInvoice upcoming = payment.GetUpcomingInvoice(cust.Id);
            payment.Unsubscribe(cust.Id, true);
            payment.DeletePlan(planInfo.Id);
            foreach (StripeInvoiceLineItem line in upcoming)
            {
                Console.WriteLine("{0} for type {1}", line.Amount, line.GetType());
            }
        }
Beispiel #3
0
        private static void TestCreateSubscription(StripePayment payment)
        {
            StripeCustomer cust = payment.CreateCustomer(new StripeCustomerInfo { Card = GetCC() });
            //StripePlan temp = new StripePlan { Id = "myplan" };
            //DeletePlan (temp, payment);
            StripePlan plan = CreatePlan(payment);
            StripeSubscription sub = payment.Subscribe(
                cust.Id, new StripeSubscriptionInfo { Card = GetCC(), Plan = "myplan", Prorate = true });

            StripeSubscription sub2 = payment.GetSubscription(sub.CustomerID);

            TestDeleteSubscription(cust, payment);
            DeletePlan(plan, payment);
        }