#daniell_74820
1 messages · Page 1 of 1 (latest)
Hello 👋
You'd need to set tax_id_collection dynamically when creating checkout sessions
https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-tax_id_collection
In order for that, you'd need to know if the customer is purchasing as an individual or a business
how can i do that? can you please be a little bit precise?
how can i do that? can you please be a little bit precise?
about which part?
first on creating checkout session, please
const sessionConfig: Stripe.Checkout.SessionCreateParams = {
line_items: [
{
price: priceId,
quantity: 1,
adjustable_quantity: {
enabled: true,
maximum: 30,
minimum: 1
}
}
],
mode: 'payment',
invoice_creation: {
enabled: false,
},
billing_address_collection: "required",
success_url: ${YOUR_DOMAIN}/bestellung?session_id={CHECKOUT_SESSION_ID},
cancel_url: ${YOUR_DOMAIN}/bestellung-abgebrochen,
automatic_tax: { enabled: true },
};
did you check the link I shared? It shows you the parameter you need to add to your code for tax ID collection
https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-tax_id_collection
Here's a doc that covers pretty much everything re: tax ID collection
https://stripe.com/docs/tax/checkout/tax-ids
I'd highly recommend reading that
So, I added the line ´ tax_id_collection: {
enabled: true
},´ to the creation of my checkout session and a checkbox is shown.
Oh nice, yeah I forgot we had the checkbox
I thought we directly showed the input field
is the type of vat id automatically inferred?
I am using a webhook and listen to the events: 'checkout.session.completed', 'checkout.session.async_payment_succeeded' and 'checkout.session.async_payment_failed'. I am not sure how to handle https://stripe.com/docs/api/events/types#event_types-customer.tax_id.updated in this context. Is there any dependency or edge case to handle?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Not sure I fully grasp the question? Can you elaborate?
like what sort of dependency or edge case exactly?
in my mental model i can not integrate the the customer.tax_id.updated event with the other events 'checkout.session.completed', 'checkout.session.async_payment_succeeded' and 'checkout.session.async_payment_failed' in the webhook. For example: What happens, if the vatid is not valid? Does the customer account charged in this case?
Ok thanks this anserwers my questions. Is there a customer object created automatically, if tax id is created? In my context; I am using stripe checkout (stripe hosted) one time payment.
Is there a customer object created automatically, if tax id is created? In my context; I am using stripe checkout (stripe hosted) one time payment.
that I'm not sure about, you can just test it out quickly