/// <summary> /// Create Customer /// </summary> /// <param name="payment">StripePayment</param> /// <param name="paymentResponse">Payment Response</param> /// <createdby>Sumit Saurav</createdby> /// <createdDate>may/22/2014</createdDate> /// <returns>string type Customer id.</returns> static string CreateCustomer(StripePayment payment, PaymentResponse paymentResponse) { StripeCustomerInfo customer = new StripeCustomerInfo() { Email = paymentResponse.CustomerEmail, Description = paymentResponse.NameOnCard + "-" + paymentResponse.BusinessName, Card = GetCC(paymentResponse), }; StripeCustomer response = payment.CreateCustomer(customer); string customer_id = response.ID; return(customer_id); }
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); } }
public string ProcessPayment(string FirstName, string LastName, string EmailAddress, string CardNumber, string ExpMonth, string ExpYear, string Cvv) { StripePayment payment = new StripePayment("OxGcTunKYwFuBr6JPDpX1mehWlXHIJ7k"); StripeCustomerInfo customer = new StripeCustomerInfo { Email = EmailAddress, Card = new StripeCreditCardInfo { Number = CardNumber, ExpirationMonth = Convert.ToInt32(ExpMonth), ExpirationYear = Convert.ToInt32(ExpYear), FullName = FirstName + " " + LastName } }; StripeCustomer response = payment.CreateCustomer(customer); string customerId = response.ID; return(payment.Charge(2500, "usd", customerId, "QuadAutomotive Group Application Fee").ID); }
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); } }