static void Main(string [] args) { StripeApi gateway = new StripeApi("YOURSECRETKEYGOESHERE"); TestSimpleCharge(gateway); TestCustomer(gateway); TestCustomerAndCharge(gateway); TestGetCharges(gateway); TestGetCustomers(gateway); }
static void TestCustomer(StripeApi gateway) { StripeCustomerInfo customer = new StripeCustomerInfo (); //customer.Card = GetCC (); StripeCustomer customer_resp = gateway.CreateCustomer(customer); string customer_id = customer_resp.ID; StripeCustomer customer_info = gateway.GetCustomer(customer_id); Console.WriteLine (customer_info); StripeCustomer ci2 = gateway.DeleteCustomer(customer_id); if (ci2.Deleted == false) throw new Exception ("Failed to delete " + customer_id); }
static void TestCustomerAndCharge(StripeApi gateway) { StripeCustomerInfo customer = new StripeCustomerInfo (); //customer.Card = GetCC (); StripeCustomer response = gateway.CreateCustomer(customer); string customer_id = response.ID; StripeCustomer customer_info = gateway.GetCustomer(customer_id); Console.WriteLine (customer_info); StripeCustomerInfo info_update = new StripeCustomerInfo (); info_update.Card = GetCC (); StripeCustomer update_resp = gateway.UpdateCustomer(customer_id, info_update); Console.Write ("Customer updated with CC. Press ENTER to continue..."); Console.Out.Flush (); Console.ReadLine (); StripeCustomer ci2 = gateway.DeleteCustomer(customer_id); if (ci2.Deleted == false) throw new Exception ("Failed to delete " + customer_id); }
static void TestSimpleCharge(StripeApi gateway) { StripeCreditCardInfo cc = GetCC (); StripeCharge charge = gateway.Charge(5001, "usd", cc, "Test charge"); Console.WriteLine (charge); string charge_id = charge.ID; StripeCharge charge_info = gateway.GetCharge(charge_id); Console.WriteLine (charge_info); }
static void TestGetCustomers(StripeApi gateway) { List<StripeCustomer> customers = gateway.GetCustomers(0, 10); Console.WriteLine (customers.Count); }
static void TestGetCharges(StripeApi gateway) { List<StripeCharge> charges = gateway.GetCharges(0, 10); Console.WriteLine (charges.Count); }