【发布时间】:2021-05-10 17:08:27
【问题描述】:
我无法从 Stripe 中的成功付款记录中检索/查看我设置的元数据。在 .NET 核心服务器端,我正在创建一个支付意图并使用条带 .NET Core SDK 将意图秘密返回给客户端,如下所示:
[HttpGet]
public async Task<IActionResult> Index()
{
StripeConfiguration.ApiKey = stripeSecretKey;
var options = new PaymentIntentCreateOptions
{
Amount = 2999,
Currency = "CAD",
PaymentMethodTypes = new List<string>(){"card"},
Metadata = new Dictionary<string,string>()
{
{"stripePaymentFormId", "value1"}
{"camperId", "value2"}
}
};
var service = new PaymentIntentService();
var paymentIntent = service.Create(options);
return View(paymentIntent.ClientSecret);
}
在客户端,我使用 intentClient Secret 执行“confirmCardPayment”操作:
stripe.confirmCardPayment(intentClientSecret, {
payment_method: {
card: card,
type: 'card',
billing_details: {
name: `${billingName} ${billingLastName}`
}
},
}).then(function (result) {
//Handle success and errors
}
成功处理后,“付款成功”记录将添加到仪表板(不同的 ID)。金额和货币是从原始意图结转的,但是此新支付对象中缺少元数据:
问题:
- Stripe 为每笔交易创建 2 条支付记录(1 条成功,1 条不完整)是否正常?
- 我是否需要在 stripe.confirmCardPayment 期间再次明确传递我的元数据?
【问题讨论】:
标签: javascript c# asp.net-core stripe-payments