【问题标题】:namespace StripeCustomerUpdateSubscriptionOptions can not be found找不到命名空间 StripeCustomerUpdateSubscriptionOptions
【发布时间】:2017-06-16 00:24:48
【问题描述】:

我正在从 stripe.net 1.2.0 dll 更新

我的原始代码是这样的
var myUpdatedSubscription = new StripeCustomerUpdateSubscriptionOptions(); 但现在我得到 no namespace not found 错误 使用新的 stripe.net v7。

var myUpdatedSubscription = new StripeCustomerUpdateSubscriptionOptions();
                        myUpdatedSubscription.PlanId = SelectedSubscription;
                        myUpdatedSubscription.TokenId = stripeToken;
                        myUpdatedSubscription.Quantity = 1;

                        var customerService = new StripeCustomerService();
                        StripeSubscription subscription = customerService.UpdateSubscription(StripeCustomerID, myUpdatedSubscription);

                        objCompany.SubscribeCompany(CompanyID, StripeCustomerID, SelectedSubscription);
                        pnlForm.Visible = false;
                        pnlPaymentSuccessful.Visible = true;

【问题讨论】:

标签: c# stripe-payments


【解决方案1】:

管理订阅已从 StripeCustomerService 转移到新的 StripeSubscriptionService。有了这个,一些涉及的类型的名称也发生了变化。因此,例如,您现在可以使用 StripeSubscriptionUpdateOptions,而不是 StripeCustomerUpdateSubscriptionOptions

【讨论】:

  • 谢谢!你知道 CurrentPeriodStart 去哪儿了吗?似乎它应该在订阅中,但事实并非如此。 var customerService = new StripeCustomerService(); StripeCustomer stripeCustomer = customerService.Get(StripeCustomerID);字符串 CustomerDescription = stripeCustomer.Description.ToString(); DateTime SubscriptionStarts = (DateTime)stripeCustomer.Subscription.CurrentPeriodStart;
  • @user713813 您现在使用传递 customerId 和 subscriptionId 的 Get 方法从 StripeSubscriptionService 获取订阅。只需使用 github.com/jaymedavis/stripe.net 上的文档了解如何操作。
  • 如果有人好奇,你可以使用 var subscriptionService = new StripeSubscriptionService(); IEnumerable 响应 = subscriptionService.List(stripeCustomer.Id.ToString());然后 foreach(响应中的 var 响应){ StripeSubscriptionID = response.Id.ToString(); }
  • 请注意,在最新版本的 Stripe 中,“Stripe”一词已从大多数(如果不是全部)类名称中删除。所以 StripeCustomerService 现在是 CustomerService 等
  • stripe.com/docs/api/subscriptions/create?lang=dotnet 的文档包含更新的类名。
猜你喜欢
  • 1970-01-01
  • 2015-06-20
  • 2012-07-14
  • 2011-03-10
  • 2017-08-13
  • 2019-08-31
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多