#csn_code
1 messages · Page 1 of 1 (latest)
👋 Welcome to your new thread!
⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1313531696292954153
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
I don't understand the unexpected behaviour here. Can you explain differently or tell me the expected vs observed behaviour in Checkout?
(i can refer to the api calls above, but i mean the steps after arriving on Checkout)
Hello! Yes, this is the workflow: I have a web platform where I sell subscriptions for a product on a monthly or yearly basis. When a user buys a subscription for a product, I create a checkout for this. The issue is that in the checkout, I set up the tax behavior to be exclusive of the product price, but this price is shown without the tax at the start . When I click on the payment method, the tax is applied. I will send a photo to illustrate the situation.
I don't think it's user-friendly to change prices in the middle of a checkout ahah
API calls
- plan.created
- price.created
- product.created
Ah, i looks like this is because we don't know the customer location until you make that selection to get the billing address country
Oh ok thanks, i define the customer address when i created them
const session = await stripe.checkout.sessions.create({
payment_method_types: ["card", "sepa_debit"],
automatic_tax: { enabled: true },
line_items: [
{
price: priceId as string,
quantity: 1,
},
],
customer: customer.data[0].id,
mode: "subscription",
success_url: body.success_url,
cancel_url: body.cancel_url,
customer_update: {
address: "auto",
shipping: "auto",
},
metadata: {
id: item.id,
},
expires_at: Math.floor(Date.now() / 1000) + 30 * 60,
billing_address_collection: "auto",
})
Maybe i need to change the address auto?
you can test the auto-location feature (based on customer IP) by using test customer emails:
customer_email="test+location_FR@example.com"
or you can use a VPN or other geoshifting tool to access your page from a specific country to see the experience for those customers
Oh hang on, that might not apply for taxes, since its only the checkout-collected address
So you may need to test using the geoshifting approach
for example if i have tax registrations in place and access from a vm in france i get tax applied right away
Yes the tax works well, the issue is the user need to click on a method payment to see it
I do a video if you want
Look the tax is applied after
Where are you physically located?
Before you enter a billing/shipping address, tax will be based on geolocation of your IP
Yes
If you share a test session URL i can access it on my VM in FR and show you how i see it
Hello! I'm taking over and catching up...
Hi, thank you ! If you have any question i'm here !
We've been investigating this, and it seems like this is expected behavior for Checkout in certain situations. You can avoid this by setting a billing address on the Customer associated with the Checkout Session before sending them to Checkout.
By set up the custom in Stripe right ?
I already do it before sending the checkout
const customer = await stripe.customers.create({
metadata: {
id: data.id,
},
name: data.name,
email: data.email,
address: {
line1: data.full_address.line1,
country: data.full_address.country,
postal_code: data.full_address.postal_code,
city: data.full_address.city,
},
})
return customer
}```
Is the full address present, and is it a valid address? Stripe Tax should use that if it exists and is valid.
Try setting validate_location to immediately in that Customer creation call and see what happens: https://docs.stripe.com/api/customers/update#update_customer-tax-validate_location
Maybe i do something wrong but i still have the issue, i send you the log
customer created
{
"object": {
"id":
"cus_RKfUidW2VlrAuB"
,
"object":
"customer",
"address": {
"city":
"Neuilly-sur-seine",
"country":
"FR",
"line1":
"5 Allée d'Orleans",
"line2":
null,
"postal_code":
"92200",
"state":
null,
},
"balance":
0,
"created":
1733247914
,
"currency":
null,
"default_source":
null,
"delinquent":
false,
"description":
null,
"discount":
null,
"email":
"shaan.narain@sairen.io",
"invoice_prefix":
"F0CD2658",
"invoice_settings": {
"custom_fields":
null,
"default_payment_method":
null,
"footer":
null,
"rendering_options":
null,
},
"livemode":
false,
"metadata": {
"id":
"34928fcd-4eb3-4a20-a147-dae7fa7faab6",
},
"name":
"Sairen",
"phone":
null,
"preferred_locales": [],
"shipping":
null,
"tax_exempt":
"none",
"test_clock":
null,
},
Looking...
Session
{
id: 'cs_test_a1VSoYUXmHMXelJlsnCxLEs3eIQiczwQvWGVsEGSXiX7UYdEmXQpiYX3WU',
object: 'checkout.session',
adaptive_pricing: null,
after_expiration: null,
allow_promotion_codes: null,
amount_subtotal: 40000,
amount_total: 40000,
automatic_tax: {
enabled: true,
liability: { type: 'self' },
status: 'requires_location_inputs'
},
billing_address_collection: 'auto',
cancel_url: 'http://localhost:4200/products/all',
client_reference_id: null,
client_secret: null,
consent: null,
consent_collection: null,
created: 1733248081,
currency: 'eur',
currency_conversion: null,
custom_fields: [],
custom_text: {
after_submit: null,
shipping_address: null,
submit: null,
terms_of_service_acceptance: null
},
customer: 'cus_RKfUidW2VlrAuB',
customer_creation: null,
customer_details: {
address: null,
email: 'shaan.narain@sairen.io',
name: null,
phone: null,
tax_exempt: 'none',
tax_ids: null
},
customer_email: null,
expires_at: 1733249881,
invoice: null,
invoice_creation: null,
livemode: false,
locale: null,
mode: 'subscription',
payment_intent: null,
payment_link: null,
payment_method_collection: 'always',
payment_method_configuration_details: null,
payment_method_options: { card: { request_three_d_secure: 'automatic' } },
payment_method_types: [ 'card', 'sepa_debit' ],
payment_status: 'unpaid',
phone_number_collection: { enabled: false },
recovered_from: null,
saved_payment_method_options: {
allow_redisplay_filters: [ 'always' ],
payment_method_remove: null,
payment_method_save: null
},
setup_intent: null,
shipping_address_collection: null,
shipping_cost: null,
shipping_details: null,
shipping_options: [],
status: 'open',
submit_type: null,
subscription: null,
success_url: 'http://localhost:4200/members/all',
total_details: { amount_discount: 0, amount_shipping: 0, amount_tax: 0 },
ui_mode: 'hosted',
}
Okay, not sure what's going on. We'll need to investigate this further internally and get back to you async.
Hello @quasi smelt, we have sent you a direct message, please check it at https://discord.com/channels/@me/1313568952420532265
- 🔗The message has instructions on how to open a direct support case with our Developer Support team, in order to help you more effectively.
Please open a case using the link you received, which will go directly to us, and from there we'll respond later with more info.
Ok thank you, have a nice day !