private static StripePlan CreatePlan(StripePayment payment) { StripePlan plan = payment.CreatePlan(GetPlanInfo()); StripePlan plan2 = payment.GetPlan(plan.Id); //DeletePlan (plan2, payment); return plan2; }
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()); } }