コード例 #1
0
ファイル: _fixture.cs プロジェクト: svedi/stripe-dotnet
        public usage_record_fixture()
        {
            var subOptions = new StripeSubscriptionCreateOptions
            {
                Items = new List <StripeSubscriptionItemOption>
                {
                    new StripeSubscriptionItemOption {
                        PlanId = Cache.GetPlan("Metered Plan", "metered").Id
                    }
                }
            };

            var service              = new StripeSubscriptionService(Cache.ApiKey);
            var customer_id          = Cache.GetCustomer().Id;
            var subscription         = service.Create(customer_id, subOptions);
            var subscription_item_id = subscription.Items.Data[0].Id;

            UsageRecordCreateOptions = new StripeUsageRecordCreateOptions()
            {
                Action           = "increment",
                SubscriptionItem = subscription_item_id,
                Timestamp        = DateTime.Now,
                Quantity         = 2000
            };

            var usageRecordService = new StripeUsageRecordService(Cache.ApiKey);

            UsageRecord = usageRecordService.Create(UsageRecordCreateOptions);
        }
コード例 #2
0
        public StripeUsageRecordServiceTest()
        {
            this.service = new StripeUsageRecordService();

            this.createOptions = new StripeUsageRecordCreateOptions()
            {
                Quantity         = 10,
                SubscriptionItem = "si_123",
                Timestamp        = DateTime.Now,
            };
        }