我使用的是最新版本的Stripe.netStripe.net方法: '無效Stripe.StripeCustomerCreateOptions.set_Card(Stripe.StripeCreditCardOptions)'
await SubscriptionsFacade.SubscribeUserAsync(user, planId, taxPercent: taxPercent);
提高
[MissingMethodException:方法找不到:'虛空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);
}
和SubscribeUserAsync:
添加或者是卡我不確定他們是否更新它多一些,但是我們可不可以看到多一點的是認購代碼在你的控制? –
@Alex羅爾我更新我的回答,顯示控制器代碼 – user299709