【发布时间】:2021-01-31 15:10:15
【问题描述】:
我是 Stripe 的新手。我在 .NET 中使用 Stripe 实现了一个卡支付系统。
我的代码如下:
var options = new SessionCreateOptions
{
PaymentMethodTypes = new List<string> { "card", },
LineItems = new List<SessionLineItemOptions> {
new SessionLineItemOptions {
PriceData = new SessionLineItemPriceDataOptions {
UnitAmount = productPrice, // in cents
Currency = currency,
ProductData = new SessionLineItemPriceDataProductDataOptions {
Name = productName
},
},
Quantity = 1,
},
},
Mode = "payment",
PaymentIntentData = new SessionPaymentIntentDataOptions
{
ReceiptEmail = customerEmail,
Description = productName
},
SuccessUrl = domain + "/Home/PaymentSuccess?session_id={CHECKOUT_SESSION_ID}",
CancelUrl = domain + "/Home/PaymentCancel",
Customer = customerId // From database
};
var service = new SessionService();
Session session = service.Create(options);
jsonToReturn = Json(new { id = session.Id });
正如你在上面看到的,我传递了我存储在数据库中的 CustomerId。
问题是每个付款客户输入同一张卡 4242 4242 4242 4242 并具有相同的有效期 12/20 和 CVV 123,但是当在仪表板上看到时,Stripe 正在创建多张卡为同一客户。
另外,我可以传递一个支付方式ID(卡ID保存在Stripe中用于过去结帐),这样客户就不需要输入卡详细信息,可以直接选择过去结帐时使用的卡吗?
【问题讨论】:
标签: .net asp.net-mvc stripe-payments