r4i*_*id4 12 checkout stripe-payments
我已经在上实现了新Stripe Checkout功能NodeJS server,但无法指定发票的税率。
根据我的理解,应在“ 付款意图” API中指定税率。事实是,新产品通过其CreateSession(请参阅参考资料)自动创建了一个,但我无法在其创建时插入税率。CheckoutPayment Intentpayment_intent_data
如何才能做到这一点?我要实现的是让用户在Checkout UI和最后都知道Tax%email invoice。
这是我的代码:
return stripe.checkout.sessions.create({
payment_method_types: [paymentMethod],
line_items: [{
name: name,
description: description,
images: [imageUrl],
amount: amount,
currency: currency,
quantity: 1
}],
success_url: successUrl,
cancel_url: cancelUrl,
customer: stripeId,
payment_intent_data: {
receipt_email: email,
metadata: {
userId: userId,
amount: amount,
currency: currency,
ref: ref,
stripeId: stripeId,
details: details
}
}
}).then(session => {
return res.send(session)
Run Code Online (Sandbox Code Playgroud)
在此回答时,Stripe Checkout 不支持税率。
一种替代方法是使用“设置”模式结帐 [1] 收集付款详细信息,然后使用结帐中收集的 PaymentMethod 和您要使用的税率从您的服务器创建 PaymentIntent [2]。
[1] https://stripe.com/docs/payments/checkout/collecting
[2] https://stripe.com/docs/api/payment_intents/create