首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >找不到Stripe.net方法:'Void Stripe.net

找不到Stripe.net方法:'Void Stripe.net
EN

Stack Overflow用户
提问于 2016-08-05 03:31:41
回答 1查看 505关注 0票数 4

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

代码语言:javascript
复制
await SubscriptionsFacade.SubscribeUserAsync(user, planId, taxPercent: taxPercent);

加薪

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

有什么改变吗?我更新了最新版本,现在我的Stripe.net应用程序坏了。Stripe介绍了一种新的制作卡片的方法吗?

下面是完整的代码:

代码语言:javascript
复制
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);
}

和SubscribeUserAsync:

https://github.com/pedropaf/saas-ecom/blob/1370ac169807e97ffb7414610d5be4de4a3cc9ae/SaasEcom.Core/Infrastructure/Facades/SubscriptionsFacade.cs

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-08-05 19:49:24

据我所知,SubscribeUserAsync需要一张卡和它的电话。

代码语言:javascript
复制
private async Task<Subscription> SubscribeUserAsync
(SaasEcomUser user, string planId, CreditCard creditCard, int trialInDays = 0, decimal taxPercent = 0)

代码语言:javascript
复制
public async Task<Subscription> SubscribeUserAsync
(SaasEcomUser user, string planId, decimal taxPercent = 0, CreditCard creditCard = null)

因为你是在订阅一个用户,所以它很可能想要一张信用卡。我会通过创建令牌或通过调用和现有的卡添加一张卡片

代码语言:javascript
复制
 var customer = new StripeCustomerService();
 var customerInfo = customer.Get(user.CustomerIdentifier);
 //then store card with  customerInfo.DefaultSourceId  somewhere and use it
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38780649

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档