public static string BuySign(BuySignModel model) { var errorMessage = string.Empty; var validationError = string.Empty; var chargeId = string.Empty; //if (ModelState.IsValid) //{ //try //{ var tokenId = GetTokenId(model); chargeId = ChargeCustomer(tokenId); //} //catch (Exception e) //{ // errorMessage = e.Message; //} //} return(null); //...rest of the code omitted for clarity }
private static string GetTokenId(BuySignModel model) { var myCardToken = new StripeCreditCardOptions { //AddressCountry = model.CardAddressCountry, //AddressLine1 = model.CardAddressLine1, //AddressLine2 = model.CardAddressLine2, //AddressCity = model.CardAddressCity, //AddressZip = model.CardAddressZip, //Cvc = model.CardCvc.ToString(CultureInfo.CurrentCulture), //ExpirationMonth = model.CardExpirationMonth, //ExpirationYear = model.CardExpirationYear, //Name = model.CardName, //Number = model.CardNumber AddressCountry = "Brazil (BR)", AddressLine1 = " ", AddressLine2 = " ", AddressCity = " ", AddressZip = " ", Cvc = "954", ExpirationMonth = "1", ExpirationYear = "2020", Name = " ", Number = "4000000760000002" }; var myToken = new StripeTokenCreateOptions { Card = myCardToken }; var tokenService = new StripeTokenService(); var stripeToken = tokenService.Create(myToken); return(stripeToken.Id); }