/// <summary> /// Stores the credit card. /// </summary> /// <param name="service">The Paychoice service.</param> private static void StoreCreditCard(IPaychoiceService service) { CreditCard card = new CreditCard() { CardName = "John Smith", Number = "4111-1111-1111-1111", ExpiryMonth = 12, ExpiryYear = 16, CVV = "123" }; Console.WriteLine("Storing credit card"); var storedCard = service.Store(card); Console.WriteLine("Token: {0}", storedCard.token); }
/// <summary> /// Stores the credit card and charges the cards token. /// </summary> /// <param name="service">The Paychoice service.</param> private static void StoreCreditCardAndChargeToken(IPaychoiceService service) { CreditCard card = new CreditCard() { CardName = "John Smith", Number = "4111-1111-1111-1111", ExpiryMonth = 12, ExpiryYear = 16, CVV = "123" }; string currency = "AUD"; decimal amount = 12.00m; string reference = "Inv #" + Guid.NewGuid().ToString(); var storedCard = service.Store(card); Console.WriteLine("Charging token"); var charge = service.Charge(storedCard.token, reference, currency, amount); Console.WriteLine("Charge id: {0} {1}", charge.Id, charge.Status); }