//Sync public virtual StripeToken Create(StripeTokenCreateOptions createOptions, StripeRequestOptions requestOptions = null) { return(Mapper <StripeToken> .MapFromJson( Requestor.PostString(this.ApplyAllParameters(createOptions, Urls.Tokens, false), SetupRequestOptions(requestOptions)) )); }
//Sync public virtual StripeToken Create(StripeTokenCreateOptions createOptions, StripeRequestOptions requestOptions = null) { return Mapper<StripeToken>.MapFromJson( Requestor.PostString(this.ApplyAllParameters(createOptions, Urls.Tokens, false), SetupRequestOptions(requestOptions)) ); }
public static string GetTokenId(paymentrequestfortoken model) { string token = ""; var myToken = new StripeTokenCreateOptions { Card = new StripeCreditCardOptions { // set these properties if passing full card details (do not // set these properties if you set TokenId) Number = model.cardnumber, // "4242424242424242", ExpirationYear = model.expiryear, // "2022", ExpirationMonth = model.expirymonth, // "10", //AddressCountry = "US", // optional //AddressLine1 = "24 Beef Flank St", // optional //AddressLine2 = "Apt 24", // optional //AddressCity = "Biggie Smalls", // optional //AddressState = "NC", // optional //AddressZip = "27617", // optional Name = model.Name, // optional // Cvc = "1223" // optional } }; // if you need this... // set this property if using a customer (stripe connect only) //myToken.CustomerId = *customerId*; var tokenService = new StripeTokenService(); StripeToken stripeToken = tokenService.Create(myToken); token = stripeToken.Id; return token; }
//Async public virtual async Task <StripeToken> CreateAsync(StripeTokenCreateOptions createOptions, StripeRequestOptions requestOptions = null, CancellationToken cancellationToken = default(CancellationToken)) { return(Mapper <StripeToken> .MapFromJson( await Requestor.PostStringAsync(this.ApplyAllParameters(createOptions, Urls.Tokens, false), SetupRequestOptions(requestOptions), cancellationToken).ConfigureAwait(false) )); }
public virtual StripeToken Create(StripeTokenCreateOptions createOptions) { var url = ParameterBuilder.ApplyAllParameters(createOptions, Urls.Tokens); var response = Requestor.PostString(url); return Mapper<StripeToken>.MapFromJson(response); }
public virtual StripeToken Create(StripeTokenCreateOptions createOptions) { var url = ParameterBuilder.ApplyAllParameters(createOptions, Urls.Tokens); var response = Requestor.PostString(url); return(Mapper <StripeToken> .MapFromJson(response)); }
//Async public virtual async Task<StripeToken> CreateAsync(StripeTokenCreateOptions createOptions, StripeRequestOptions requestOptions = null, CancellationToken cancellationToken = default(CancellationToken)) { return Mapper<StripeToken>.MapFromJson( await Requestor.PostStringAsync(this.ApplyAllParameters(createOptions, Urls.Tokens, false), SetupRequestOptions(requestOptions), cancellationToken) ); }
protected string getStripeToken(string cardNumber, string expirationYear, string expirationMonth, string cvc) { var myToken = new StripeTokenCreateOptions(); // if you need this... myToken.Card = new StripeCreditCardOptions() { // set these properties if passing full card details (do not // set these properties if you set TokenId) Number = cardNumber, ExpirationYear = expirationYear, ExpirationMonth = expirationMonth, //AddressCountry = "US", // optional //AddressLine1 = "24 Beef Flank St", // optional //AddressLine2 = "Apt 24", // optional //AddressCity = "Biggie Smalls", // optional //AddressState = "NC", // optional //AddressZip = "27617", // optional //Name = "Joe Meatballs", // optional Cvc = cvc }; var tokenService = new StripeTokenService(); StripeToken stripeToken = tokenService.Create(myToken); return stripeToken.Id; }
public override PaymentResponse MakePayment() { try { #region Create Token //Get Stripe API Key StripeConfiguration.SetApiKey( CompanyConfigurationSettings.CompanyConfigList.Find (cc => cc.Name.Equals(System.Configuration.ConfigurationSettings.AppSettings["creditsHero_Stripe:ApiKey"])).Value); var newToken = new StripeTokenCreateOptions(); newToken.Card = new StripeCreditCardOptions() { Number = this.CardNumber, ExpirationYear = this.ExpirationYear, ExpirationMonth = this.ExpirationMonth, AddressCountry = "US", AddressLine1 = this.AddressLine1, AddressLine2 = this.AddressLine2, AddressCity = this.AddressCity, AddressState = this.AddressState, AddressZip = this.AddressZip, Name = this.Name, Cvc = this.Cvc }; var tokenService = new StripeTokenService(); StripeToken stripeToken = tokenService.Create(newToken); #endregion #region Create Charge var newCharge = new StripeChargeCreateOptions(); newCharge.Amount = Int32.Parse(this.Amount.ToString()); newCharge.Currency = "usd"; newCharge.Description = ""; newCharge.Capture = true; var chargeService = new StripeChargeService(); StripeCharge stripeCharge = new StripeCharge(); stripeCharge.LiveMode = Boolean.Parse(System.Configuration.ConfigurationSettings.AppSettings["creditsHero_Stripe:IsLive"]); var results = chargeService.Create(newCharge); #endregion return new PaymentResponse() { AuthCode = results.Status, Message = results.Status, MessageCode = results.Status, ResponseCode = results.Status, TransactionId = results.Status, TransactionResult = results.Status }; } catch (System.Exception exc) { return new PaymentResponse() { ErrorMessage = exc.Message, Message = exc.StackTrace, TransactionResult = String.Format("Paypal Error:{0}--{1}", exc.Message, exc.StackTrace) }; } }