Exemple #1
0
        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"
            });

            var           invoices = payment.GetInvoices(0, 10, cust.ID);
            StripeInvoice upcoming = payment.GetUpcomingInvoice(cust.ID);

            payment.Unsubscribe(cust.ID, true);
            payment.DeletePlan(planInfo.ID);
            foreach (StripeLineItem line in upcoming)
            {
                Console.WriteLine("{0} for type {1}", line.Amount, line.GetType());
            }
        }
Exemple #2
0
        static void TestInvoices(StripePayment payment)
        {
            var                invoices = payment.GetInvoices(10, 10);
            StripeInvoice      inv      = payment.GetInvoice(invoices.Data [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);
        }
Exemple #3
0
        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);
        }