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 TestCustomer(StripePayment payment)
        {
            StripeCustomerInfo customer = new StripeCustomerInfo();
            //customer.Card = GetCC ();
            StripeCustomer customer_resp = payment.CreateCustomer(customer);
            string         customer_id   = customer_resp.ID;
            StripeCustomer customer_info = payment.GetCustomer(customer_id);

            Console.WriteLine(customer_info);
            StripeCustomer ci2 = payment.DeleteCustomer(customer_id);

            if (ci2.Deleted == false)
            {
                throw new Exception("Failed to delete " + customer_id);
            }
        }
Exemple #3
0
        static void TestCustomerAndCharge(StripePayment payment)
        {
            StripeCustomerInfo customer = new StripeCustomerInfo();
            //customer.Card = GetCC ();
            StripeCustomer response      = payment.CreateCustomer(customer);
            string         customer_id   = response.ID;
            StripeCustomer customer_info = payment.GetCustomer(customer_id);

            Console.WriteLine(customer_info);
            StripeCustomerInfo info_update = new StripeCustomerInfo();

            info_update.Card = GetCC();
            StripeCustomer update_resp = payment.UpdateCustomer(customer_id, info_update);

            Console.Write("Customer updated with CC. Press ENTER to continue...");
            Console.Out.Flush();
            Console.ReadLine();
            StripeCustomer ci2 = payment.DeleteCustomer(customer_id);

            if (ci2.Deleted == false)
            {
                throw new Exception("Failed to delete " + customer_id);
            }
        }