这就是当我需要 httppost 某些东西时我的问题。然后我想接收subscription.LatestInvoice.PaymentIntent.ClientSecret我的 js 文件的值。当我单击“付款”时,剥离必须subscription.LatestInvoice.PaymentIntent.ClientSecret为我的 js 文件指定一个值。但它永远不会出来。然而,Stripe 告诉我:未捕获的集成错误:stripe.handleCardPayment 意图机密的值无效:值应为 ${id}机密${secret} 形式的客户端机密。您指定: 。我的 httppost - 控制器:[HttpPost] [Route("Members/AddMembership/{id}/{CompaniesId}")] public async Task<IActionResult> AddMembership(MembersView model) { try { //Here before that comes some strip code and everything else ... model.PiinVoice = subscription.LatestInvoice.PaymentIntent.ClientSecret; return View(model); } catch(Exception e) { TempData[TempDataClass.Error] = true; TempData[TempDataClass.ErrorMsg] = HelperText.ExceptionError + e.Message; return RedirectToAction("", "User"); } }我通过 Stripe 获得了 js 代码,该代码在此链接上。我的 JavaScript 在这里。.... more here....//I Need value from this one.var paymentIntentSecret = document.getElementById('PiinVoice').value; // Handle form submission.var form = document.getElementById('payment-form'); form.addEventListener('submit', function (event) { event.preventDefault(); stripe.handleCardPayment(paymentIntentSecret).then(function(result) { if (result.error) { // Display error.message in your UI. // Inform the user if there was an error. var errorElement = document.getElementById('card-errors'); errorElement.textContent = result.error.message; } else { // The payment has succeeded. Display a success message. stripeTokenHandler(result.token); } });});.... more here...我想知道是否可以这样做,并将其subscription.LatestInvoice.PaymentIntent.ClientSecret放入我的 PiinVoice 中。它的实现与 3D Secure 相关。反对如果我在 3d 之前运行旧代码。付款后进去找到发票 ID 并扔进去,var paymentIntentSecret = "xxxxxxx"然后就可以正常工作了
1 回答
慕斯王
TA贡献1864条经验 获得超2个赞
您是否尝试过打印subscription.LatestInvoice.PaymentIntent.ClientSecret
后端代码来调查此问题?因为它似乎是空的。
var options = new SubscriptionCreateOptions
{
CustomerId = customer.Id,
Items = items,
Expand = new List<string>() { "latest_invoice.payment_intent" }
};
var subscriptionServices = new SubscriptionService();
Subscription subscription = subscriptionServices.Create(options);
- 1 回答
- 0 关注
- 102 浏览
添加回答
举报
0/150
提交
取消