新 Stripe Checkout 中的税率

2024-03-28


我已经实施了新的Stripe Checkout on my NodeJS server,但我无法指定Tax Rate用于发票。

据我的理解税率应指定在支付意向API https://stripe.com/docs/api/payment_intents/object#payment_intent_object-invoice。事实是,新Checkout自动创建一个Payment Intent通过其创建会话 https://stripe.com/docs/api/checkout/sessions/create (see payment_intent_data),但我无法插入Tax Rate在其创建时。

如何才能做到这一点?我想要实现的是让用户知道税收百分比Checkout UI并在决赛中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)

截至本回答时,Stripe Checkout 不支持税率。

一种替代方法是使用“设置”模式 Checkout [1] 收集付款详细信息,然后使用 Checkout 中收集的 PaymentMethod 和您想要使用的税率从您的服务器创建 PaymentIntent [2]。

[1] https://stripe.com/docs/ payments/checkout/collecting https://stripe.com/docs/payments/checkout/collecting

[2] https://stripe.com/docs/api/ payment_intents/create https://stripe.com/docs/api/payment_intents/create

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

新 Stripe Checkout 中的税率 的相关文章

随机推荐