22


I've implemented the new Stripe Checkout on my NodeJS server, but I cannot specify the Tax Rate for Invoicing.

As per my understanding Tax Rates should be specified in the Payment Intent API. Fact is that the new Checkout automatically creates a Payment Intent via its CreateSession (see payment_intent_data), but I'm not able to insert a Tax Rate upon its creation.

How can this be done? What I want to achieve is to have the user know the Tax % both in the Checkout UI and in the final email invoice.

This is my code:

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)
Super Kai - Kazuya Ito
  • 22,221
  • 10
  • 124
  • 129
r4id4
  • 5,877
  • 8
  • 46
  • 76
  • 1
    Tax Rates only apply to `Invoice` objects, which are primarily used in conjunction with `Subscriptions`, not the one time payment 'line items' created by this checkout session. https://stripe.com/docs/api/subscriptions/create#create_subscription-items-tax_rates https://stripe.com/docs/api/payment_intents/create I might email Stripe with a feature request on this! – duck May 12 '19 at 16:48
  • @duck thanks for your reply. So there is no way to insert Tax Rate in one time payment 'line items' ? :( I could I let user know the % of tax charged? – r4id4 May 12 '19 at 17:39
  • 1
    I mean, it's a list of hashes, so I suppose you could add your own line item for the tax amount, but it wouldn't use Stripe's Tax Rate atm – duck May 12 '19 at 18:04
  • @r4id4 I'm looking for an identical setup. Have you managed to achieve it, and if so, how? – Bytech Oct 18 '19 at 09:17
  • Unfortunately no – r4id4 Oct 18 '19 at 20:08
  • It seems like feature is soon to be implemented but it's still under Beta, you'll have to write to them asking for access: checkout-beta-taxes@stripe.com, you can find info here => https://stripe.com/docs/payments/checkout/taxes#fixed-tax-rates – millenion Oct 13 '20 at 02:54

4 Answers4

7

At the time of this answer, Stripe Checkout does not support Tax Rates.

One alternative is to collect payment details using "setup" mode Checkout [1], then create a PaymentIntent [2] from your server with the PaymentMethod collected in Checkout and the Tax Rate you'd like to use.

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

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

cjav_dev
  • 2,895
  • 19
  • 25
  • w1zeman1p can you elaborate on point [2] please? I can't find any reference in the PaymentIntent API docs to adding a Tax Rate. `default_tax_rates` and `tax_rates` appear on Invoices and Subscriptions, but not PaymentIntents. – JamesG Dec 29 '19 at 21:05
  • Sorry for the confusion. PaymentIntent's allow you to specify the total amount. So you would use setup mode Checkout to store the PaymentMethod, then calculate your own taxes and add those to the subtotal and create a PaymentIntent. – cjav_dev Dec 30 '19 at 17:00
  • 1
    Thanks w1zeman1p, that's where I'd got to in the end - calculating my taxes app-side and just sending the total up to Stripe. I'll deal with the tax paperwork outside of Stripe. – JamesG Dec 30 '19 at 19:15
1

Stripe checkout support now Tax rates.

From "Stripe.net" 35.12.0 version, you can set a default tax rate when you create a new session.

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);

Don't forgot to update your webhook version if you are using one.

Nicolas Law-Dune
  • 1,631
  • 2
  • 13
  • 30
  • Yes, reading from the docs https://support.stripe.com/questions/charging-sales-tax-gst-or-vat-on-payments it looks like if we're passing mode: payment one need to calculate the tax before sending the payment. I ended up passing the VAT as a line item if needed. – Markus Knappen Johansson Oct 27 '20 at 17:39
0

Tax rates are now in beta on Stripe Checkout for one-time payments, see here: https://stripe.com/docs/payments/checkout/taxes

You can email to join the beta program and try it out.

Right now, note that dynamic tax rates are only supported in US, Europe and certain countries specified here (https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-line_items-dynamic_tax_rates) so watch out

mding5692
  • 806
  • 1
  • 10
  • 34
0

Create the object of "stripe.taxRates.create()", then, assign the "id" to "tax_rates" as shown below:

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'
});
Super Kai - Kazuya Ito
  • 22,221
  • 10
  • 124
  • 129