新条纹结帐中的税率




我已经在我的NodeJS server上实现了新的Stripe Checkout,但是我无法指定用于发票的税率

根据我的理解税率应在付款意图API中指定。事实是,新的Checkout会通过其CRETESESSINS自动创建Payment Intent(请参阅payment_intent_data(,但我无法在其创建时插入税率

如何完成?我要实现的是让用户在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)

在此答案时,条纹结帐不支持税率。

一种替代方法是使用"设置"模式结帐[1]收集付款详细信息,然后从您的服务器中创建一个付款机[2],并在结帐中收集的付款方式和您要使用的税率。

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

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

Stripe Checkout支持现在税率。

来自" stripe.net" 35.12.0版本,您可以在创建新会话时设置默认税率。

var options = new SessionCreateOptions {
    PaymentMethodTypes = new List<string> {
        "card",
    },
    SubscriptionData = new SessionSubscriptionDataOptions {
        DefaultTaxRates = new List<string> {
            _STRIPE_OPTIONS.Tax // Your tax rate id
        },
        Items = new List<SessionSubscriptionDataItemOptions> {
            new SessionSubscriptionDataItemOptions {
                Plan = request.PlanId, // Your plan id
            },
        },
    },
    Customer = customer.StripeCustomerId,
    SuccessUrl = _STRIPE_OPTIONS.SuccessUrl,
    CancelUrl = _STRIPE_OPTIONS.CancelUrl
};
var service = new SessionService();
var session = service.Create(options);

如果您使用的是一个。

,请勿忘记更新Webhook版本。

税率现已在一次性付款中的Stripe Checkout中,请参阅此处:https://stripe.com/docs/payments/checkout/checkout/taxes

您可以通过电子邮件加入Beta程序并尝试。

现在,请注意,此处指定的动态税率仅在美国,欧洲和某些国家/地区(https://stripe.com/docs/api/checkout/checkout/sessions/create#create#create_checkout_checkout_session_session-session-line_items-line_items-dynamic_tax_rates(

创建>&quot; stripe.taxrates.taxrates.create((的对象';然后,分配id' to 'sax_rates; 如下所示:

const taxRate = await stripe.taxRates.create({ // Here
    display_name: 'Sales Tax',
    percentage: 7.25,
    inclusive: false
});
const session = await stripe.checkout.sessions.create({
    line_items: [
        {
            'price_data': {
                'currency': 'usd',
                'unit_amount': 20,
                'product_data': {
                    'name': 'T-shirt',
                },
            },
            'quantity': 2,
            'tax_rates': [taxRate.id] // Here
        },
    ],
    mode: 'payment',
    success_url: 'https://example.com/success',
    cancel_url: 'https://example.com/cancel'
});

最新更新