public async Task test_payments() { StripeConfiguration.SetApiKey(ConfigurationManager.AppSettings["Stripe.SecretKey"]); var stripeTokenreateOptions = new StripeTokenCreateOptions(); stripeTokenreateOptions.Card = new StripeCreditCardOptions() { Number = "4242424242424242", ExpirationYear = "2022", ExpirationMonth = "10", }; var tokenService = new StripeTokenService(); StripeToken stripeToken = tokenService.Create(stripeTokenreateOptions); StripeCustomerCreateOptions customerCreateOptions = new StripeCustomerCreateOptions { SourceToken = stripeToken.Id, Email = $"{Guid.NewGuid()}@test.com" }; var customerService = new StripeCustomerService(); var customer = customerService.Create(customerCreateOptions); var dbConnection = ConfigurationManager.ConnectionStrings["DefaultConnection"].ToString(); var stripeService = new StripeService(dbConnection); await stripeService.TryCharge(customer.Id, 300, "AUD"); }
public async Task try_payments_with_stripe_connect() { var dbConnection = ConfigurationManager.ConnectionStrings["DefaultConnection"].ToString(); var paymentsWorker = new StripeService(dbConnection); await paymentsWorker.TryChargeUsingConnet("cus_AE3vffag7fTaVc", "acct_19tbtZDSMoDEiFde", 1000, "AUD"); }
public PaymentsWorker(string dbConnection, string apiEndpoint, string apiToken) : base(apiEndpoint, apiToken) { _dbConnection = dbConnection; _stripeService = new StripeService(_dbConnection); }