Asp.net mvc 条带API付款意图未完成付款

Asp.net mvc 条带API付款意图未完成付款,asp.net-mvc,asp.net-core,stripe-payments,Asp.net Mvc,Asp.net Core,Stripe Payments,我一直在用Stripe。当结账时,X将在客户每次到达结账时创建付款意图。这将导致“不完整”的付款 我在.Net核心应用程序中集成了条带。下面是代码: public void Pay(CardInfo cardInfo, double amount) { StripeConfiguration.ApiKey = _paramList["secretKey"]; State = PaymentState.Pend

我一直在用Stripe。当结账时,X将在客户每次到达结账时创建付款意图。这将导致“不完整”的付款

我在.Net核心应用程序中集成了条带。下面是代码:

 public void Pay(CardInfo cardInfo, double amount)
        {
            StripeConfiguration.ApiKey = _paramList["secretKey"];
            State = PaymentState.Pending;
            try
            {
                var options = new SessionCreateOptions
                {
                    Mode = "payment",
                    SuccessUrl = "https://example.com/success",
                    CancelUrl = "https://example.com/cancel",
                    Customer = cardInfo.Owner,
                    CustomerEmail = cardInfo.ParamList["email"],                                    
                    PaymentMethodTypes = new List<string>
                    {
                        "card",
                    },
                    LineItems = new List<SessionLineItemOptions>
                {
                  new SessionLineItemOptions
                  {
                    Amount = Convert.ToInt64(amount.ToString().Replace(",","")),
                    Currency = "eur",
                    Quantity = 1,
                    Name = _paramList["account"]                  
                  },
                },
                    
                };

                var service = new SessionService();
                service.Create(options);
                State = PaymentState.Accepted;
            }
            catch (StripeException error)
            {        
                State = PaymentState.Error;
                PaymentReturn = error.Message;
                Logger.Write(string.Format("Error STRIPE payment status {0} : ",PaymentReturn));
            }
      }
公共无效支付(卡迪尼奥卡迪尼奥,双倍金额)
{
StripeConfiguration.ApiKey=_paramList[“secretKey”];
状态=PaymentState.Pending;
尝试
{
var options=newsessioncreateoptions
{
Mode=“付款”,
成功URL=”https://example.com/success",
取消URL=”https://example.com/cancel",
客户=cardInfo.Owner,
CustomerEmail=cardInfo.ParamList[“电子邮件”],
PaymentMethodTypes=新列表
{
“卡”,
},
LineItems=新列表
{
新的SessionLineItemOptions
{
Amount=Convert.ToInt64(Amount.ToString().Replace(“,”,”),
货币=“欧元”,
数量=1,
名称=_参数列表[“帐户”]
},
},
};
var service=newsessionservice();
服务。创建(选项);
状态=付款状态。已接受;
}
捕获(StripeException错误)
{        
State=PaymentState.Error;
PaymentReturn=error.Message;
Write(string.Format(“错误条带支付状态{0}:”,PaymentReturn));
}
}

在我的表单支付中,我没有使用stripe表单,但我已经创建了一个,并且我检索了我需要的所有信息(卡号、CVV、到期日、电子邮件和金额)

使用stripe Checkout时,会在引擎盖下创建PaymentIntent以支持符合SCA的支付。如果会话未完成,PaymentIntent将保持状态
未完成
。这这部分是完全正常的

不支持使用签出会话与条带集成,但不重定向到条带承载的签出。如果您想支持自己处理卡片字段,那么使用Stripe.js和元素进行集成是最好的方法[1]。如果您想继续使用Stripe Checkout,因为它提供了很多现成的功能,那么一旦创建了会话,您应该使用Stripe.js[2]中的redirectToCheckout()将用户发送到Stripe Checkout

[1]


[2]

如果您正在寻找ASP.NET Core MVC中条带签出集成的最新解决方案,请查看演示==>