C# 未找到Stripe.net方法:';Void Stripe.StripeCustomerCreateOptions.set_卡(Stripe.StripeCreditCardOptions)和#x27;

C# 未找到Stripe.net方法:';Void Stripe.StripeCustomerCreateOptions.set_卡(Stripe.StripeCreditCardOptions)和#x27;,c#,stripe.net,C#,Stripe.net,我正在使用最新的Stripe.net版本 await SubscriptionsFacade.SubscribeUserAsync(user, planId, taxPercent: taxPercent); 提高 [MissingMethodException:找不到方法:'Void Stripe.StripeCustomerCreateOptions.set_Card(Stripe.StripeCreditCardOptions)' 有什么变化吗?我已更新到最新版本,现在我的Stripe.

我正在使用最新的Stripe.net版本

await SubscriptionsFacade.SubscribeUserAsync(user, planId, taxPercent: taxPercent);
提高

[MissingMethodException:找不到方法:'Void Stripe.StripeCustomerCreateOptions.set_Card(Stripe.StripeCreditCardOptions)'

有什么变化吗?我已更新到最新版本,现在我的Stripe.net应用程序已损坏。Stripe是否引入了一种新的卡片制作方法

以下是完整的代码:

public async Task<ActionResult> Register(RegisterViewModel model)
{
    if (ModelState.IsValid)
    {
        var userIP = GeoLocation.GetUserIP(Request).Split(':').First();
        var user = new ApplicationUser
        {
            UserName = model.Email, 
            Email = model.Email,
            RegistrationDate = DateTime.UtcNow,
            LastLoginTime = DateTime.UtcNow,
            IPAddress = userIP,
            IPAddressCountry = GeoLocationHelper.GetCountryFromIP(userIP),
            BillingAddress = new BillingAddress()
        };
        var result = await UserManager.CreateAsync(user, model.Password);
        if (result.Succeeded)
        {
            // Create Stripe user
            var taxPercent = user.IPAddressCountry != null && EuropeanVat.Countries.ContainsKey(user.IPAddressCountry) ? 
                EuropeanVat.Countries[user.IPAddressCountry] : 0;

            // if no plan set, default to professional
            var planId = string.IsNullOrEmpty(model.SubscriptionPlan)
                ? "starter"
                : model.SubscriptionPlan;

            var customer = new StripeCustomerService();
            var customerInfo = customer.Get(user.CustomerIdentifier);

            await SubscriptionsFacade.SubscribeUserAsync(user, planId, taxPercent: taxPercent);
            await UserManager.UpdateAsync(user);

            await SignInManager.SignInAsync(user, isPersistent:false, rememberBrowser:false);
            await UserManager.EmailService.SendWelcomeEmail(user.UserName, user.Email);

            TempData["flash"] = new FlashSuccessViewModel("Congratulations! Your account has been created.");

            return RedirectToAction("Index", "Notes");
        }
        AddErrors(result);
    }

    // If we got this far, something failed, redisplay form
    return View(model);
}

public async Task

据我所知,subscribeeuserasync需要一张带有调用的卡

private async Task<Subscription> SubscribeUserAsync
(SaasEcomUser user, string planId, CreditCard creditCard, int trialInDays = 0, decimal taxPercent = 0)

我不确定他们是否更新了一些,但我们是否可以在您的控制器中看到更多的订阅代码?@Alex Rohr我更新了我的答案以显示控制器代码。我在
用户周围发现编译错误。CustomerIdentifier
,我更新了完整控制器代码的答案。我也不确定您将如何存储卡(您的第三行注释),因为stripe用户是在帐户注册时创建的,用户没有提供信用卡。my user.CustomerIdentifier正在将客户ID附加到我的数据库并调用它。您必须将其添加到您的数据库中
public async Task<Subscription> SubscribeUserAsync
(SaasEcomUser user, string planId, decimal taxPercent = 0, CreditCard creditCard = null)
 var customer = new StripeCustomerService();
 var customerInfo = customer.Get(user.CustomerIdentifier);
 //then store card with  customerInfo.DefaultSourceId  somewhere and use it