public ChargeServiceTest( StripeMockFixture stripeMockFixture, MockHttpClientFixture mockHttpClientFixture) : base(stripeMockFixture, mockHttpClientFixture) { this.service = new ChargeService(this.StripeClient); this.captureOptions = new ChargeCaptureOptions { Amount = 123, }; this.createOptions = new ChargeCreateOptions { Amount = 123, Currency = "usd", Source = "tok_123", }; this.updateOptions = new ChargeUpdateOptions { Metadata = new Dictionary <string, string> { { "key", "value" }, }, }; this.listOptions = new ChargeListOptions { Limit = 1, }; }
public ChargeServiceTest( StripeMockFixture stripeMockFixture, MockHttpClientFixture mockHttpClientFixture) : base(stripeMockFixture, mockHttpClientFixture) { this.service = new ChargeService(this.StripeClient); this.captureOptions = new ChargeCaptureOptions { Amount = 123, }; this.createOptions = new ChargeCreateOptions { Amount = 123, Currency = "usd", Source = "tok_123", }; this.updateOptions = new ChargeUpdateOptions { FraudDetails = new ChargeFraudDetailsOptions { UserReport = "safe", }, }; this.listOptions = new ChargeListOptions { Limit = 1, }; }
public override ApiInfo CapturePayment(Order order, IDictionary <string, string> settings) { try { order.MustNotBeNull("order"); settings.MustNotBeNull("settings"); settings.MustContainKey("mode", "settings"); settings.MustContainKey(settings["mode"] + "_secret_key", "settings"); var apiKey = settings[settings["mode"] + "_secret_key"]; var chargeService = new ChargeService(apiKey); var captureOptions = new ChargeCaptureOptions() { Amount = DollarsToCents(order.TransactionInformation.AmountAuthorized.Value) }; var charge = chargeService.Capture(order.TransactionInformation.TransactionId, captureOptions); return(new ApiInfo(charge.Id, GetPaymentState(charge))); } catch (Exception exp) { LoggingService.Instance.Error <Stripe>("Stripe(" + order.OrderNumber + ") - GetStatus", exp); } return(null); }
public ChargeServiceTest() { this.service = new ChargeService(); this.captureOptions = new ChargeCaptureOptions { Amount = 123, }; this.createOptions = new ChargeCreateOptions { Amount = 123, Currency = "usd", SourceId = "tok_123", }; this.updateOptions = new ChargeUpdateOptions { Metadata = new Dictionary <string, string> { { "key", "value" }, }, }; this.listOptions = new ChargeListOptions { Limit = 1, }; }
public async Task <bool> CaptureAuthorizedCharge(string stripeAuthChargeId, int amount) { var opts = new ChargeCaptureOptions() { Amount = amount }; var chargeService = new ChargeService(); Charge charge = await chargeService.CaptureAsync(stripeAuthChargeId, opts); return(charge != null); }
public async Task <Charge> CreateCaptureAsync(string chargeId, decimal amount, decimal applicationFeeAmount) { var options = new ChargeCaptureOptions { Amount = (long)(amount * 100), ApplicationFeeAmount = (long)(applicationFeeAmount * 100) }; var service = new ChargeService(); return(await service.CaptureAsync(chargeId, options)); }
public void TestEvent(Object sender, EventArgs e) { try { var chargeOptions = new ChargeCaptureOptions { Amount = 3000, }; var chargeService = new ChargeService(); Charge charge = chargeService.Capture("ch_1DZFGDBXLNpDm6rJAZgwGBuz", chargeOptions, null); } catch (Exception ex) { } }
public static Charge CaptureCharge(string chargeId, decimal amount) { // Set your secret key: remember to change this to your live secret key in production // See your keys here: https://dashboard.stripe.com/account/apikeys StripeConfiguration.SetApiKey(SecretKey); string PaidAmountString = ConvertDecimalAmountToZeroDecimal(amount); var options = new ChargeCaptureOptions { Amount = Convert.ToInt64(PaidAmountString), }; var service = new ChargeService(); Charge charge = service.Capture(chargeId, options); return(charge); }
public void chargePenalty(string chargeId) { try { StripeConfiguration.SetApiKey("sk_test_Q5wSnyXL03yN0KpPaAMYttOb"); var chargeOptions = new ChargeCaptureOptions { Amount = 1000, }; var chargeService = new ChargeService(); Charge charge = chargeService.Capture(chargeId, chargeOptions, null); DisplayAlert("", "$10 will be charge on your account as penalty", "Ok"); }catch (Exception ex) { DisplayAlert("", ExceptionManagement.LogException(ex), "Ok"); } }
public async Task <Charge> CaptureAsync(string chargeId, ChargeCaptureOptions chargeCaptureOptions = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) { return(await chargeService.CaptureAsync(chargeId, chargeCaptureOptions, requestOptions, cancellationToken)); }
public virtual Task <Charge> Capture(string chargeId, ChargeCaptureOptions options = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) { return(Request(HttpMethod.Post, $"{InstanceUrl(chargeId)}/capture", options, requestOptions, cancellationToken)); }