示例#1
0
        public connect_fixture()
        {
            var accountService       = new StripeAccountService(Cache.ApiKey);
            var accountCreateOptions = new StripeAccountCreateOptions
            {
                DefaultCurrency = "usd",
                Email           = "*****@*****.**",
                Type            = StripeAccountType.Custom
            };

            Account = accountService.Create(accountCreateOptions);

            var chargeService = new StripeChargeService(Cache.ApiKey);

            chargeService.ExpandApplication    = true;
            chargeService.ExpandApplicationFee = true;
            Charge = chargeService.Create(
                new StripeChargeCreateOptions
            {
                SourceTokenOrExistingSourceId = "tok_visa",
                ApplicationFee = 10,
                Amount         = 100,
                Currency       = "usd"
            },
                new StripeRequestOptions
            {
                StripeConnectAccountId = Account.Id
            }
                );

            var applicationFeeService = new StripeApplicationFeeService(Cache.ApiKey);

            applicationFeeService.ExpandApplication = true;
            ApplicationFee = applicationFeeService.Get(Charge.ApplicationFeeId);
        }
示例#2
0
        public charging_from_another_account()
        {
            var anotherAccount = new StripeAccountService(Cache.ApiKey).Create(new StripeAccountCreateOptions
            {
                DefaultCurrency = "usd",
                Email           = "*****@*****.**",
                Managed         = true
            }
                                                                               );

            var chargeService = new StripeChargeService(Cache.ApiKey);

            chargeService.ExpandApplicationFee = true;

            var charge = chargeService.Create(
                new StripeChargeCreateOptions
            {
                SourceTokenOrExistingSourceId = Cache.GetToken().Id,
                ApplicationFee = 10,
                Amount         = 100,
                Currency       = "usd"
            },
                new StripeRequestOptions
            {
                StripeConnectAccountId = anotherAccount.Id
            }
                );

            var appFeeService = new StripeApplicationFeeService(Cache.ApiKey);

            appFeeService.ExpandApplication = true;

            _appFee = appFeeService.Get(charge.ApplicationFeeId);
        }
        internal static Fee TransformStripeApplicationFeeToFee(StripeApplicationFee stripeApplicationFee)
        {
            var fee = new Fee
            {
                Id                   = stripeApplicationFee.Id,
                Amount               = Sahara.Core.Common.Methods.Billing.ConvertStripeAmountToDecimals(stripeApplicationFee.Amount.ToString()),
                Refunded             = stripeApplicationFee.Refunded,
                Created              = stripeApplicationFee.Created,
                ChargeId             = stripeApplicationFee.ChargeId,
                BalanceTransactionId = stripeApplicationFee.BalanceTransactionId,
            };

            return(fee);
        }