Asp.net mvc Asp.net mvc项目中的条带集成

Asp.net mvc Asp.net mvc项目中的条带集成,asp.net-mvc,stripe-payments,Asp.net Mvc,Stripe Payments,我正在尝试将stripe集成到我的asp.net应用程序中。我使用的是Visual Studio 17,目标.Net framework是4.6.1 以下是我的控制器代码: using System; using System.Collections.Generic; using System.Configuration; using System.Linq; using System.Web; using System.Web.Mvc; using Stripe; namespace Do

我正在尝试将stripe集成到我的asp.net应用程序中。我使用的是Visual Studio 17,目标.Net framework是4.6.1

以下是我的控制器代码:

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Stripe;

namespace DonationProgram.Controllers
{
    public class DonationController : Controller
    {
        // GET: Donation
        public ActionResult Index()
        {
            var stripePublishKey = ConfigurationManager.AppSettings["pk_test_Ih2IeiHk6PmK19pdh7UPijhr"];
            ViewBag.StripePublishKey = stripePublishKey;
            return View();
        }

        public ActionResult Charge(string stripeEmail, string stripeToken)
        {
            var customers = new StripeCustomerService();
            var charges = new StripeChargeService();

            var customer = customers.Create(new StripeCustomerCreateOptions
            {
                Email = stripeEmail,
                SourceToken = stripeToken
            });

            var charge = charges.Create(new StripeChargeCreateOptions
            {
                Amount = 500,//charge in cents
                Description = "Sample Charge",
                Currency = "usd",
                CustomerId = customer.Id
            });

            // further application specific code goes here

            return View();
        }
    }
}

但是在
new StripeCustomerService()
new StripeChargeService()
&
new StripeCustomerCreateOptions
中有错误,说“类型或名称空间找不到”,尽管我使用的是条带名称空间。

这篇博文似乎不正确。您真正应该使用的是Stripe.CustomerCreateOptions或只是
CustomerCreateOptions
。同样,对于其他类,错误报告也是如此

比如说。中没有类
StripeCustomerCreateOptions
,但只定义了
CustomerCreateOptions


更新。对回购协议的进一步挖掘表明,该博客文章在某些方面是正确的,但已经过时。在2018年8月,有一次从所有面向客户的API类中删除了
条带前缀。

我对“条带”前缀有点不满。谢谢,这解决了我的问题。条带工作代码,您也可以下载应用程序,以获取条带签出集成的最新解决方案,测试演示:-在ASP.NET Web表单中使用条带接收所有卡的付款和多种付款方法。条带工作代码,您也可以下载应用程序