#developer_12345 - Checkout Session Preferred Locale

1 messages · Page 1 of 1 (latest)

fresh lintel
#

Looking in to if you can retrieve this information.

#

Have you tested this and confirmed that the first Invoice is always in the wrong language?

atomic wave
#

I have not coded the part for updating the details in the checkout.session.completed event handling but I can confirm the user was created with the language set to English when I set the locale in the checkout to French. Since the creation of the invoice and finalizing it is all concurrent and order isn't guaranteed it could be hit or miss. All the events have the exact same timestamp when reviewing this in the dashboard.

fresh lintel
#

Yep, testing now I can see that the hosted invoice URL will take locale into account but the PDF seems to be in english. Checking in to how to address this

fresh lintel
#

Apologies, the server got busy and I dropped off looking in to this. Am looking again now and reaching out to my colleagues.

#

Also just to clarify, you are already seeing that all of the subsequent invoices and receipts are being sent in the user's preferred language without having to set anything?

atomic wave
#

I haven't confirmed this but based on reading documentation, my assumption is that as soon as we update the customer object to have a preferred_locale that we would see emails/receipts/invoices in that language. I am just at the point of scoping this out to see what the best approach is

fresh lintel
#

Gotcha. Thank you for the clarification.

fresh lintel
#

Do you have the ID of that French customer so that we can look in to their case specifically?

#

Still looking in to this. Apoligies that this is taking a while

#

Actually we were able to figure this out without this. Basically, your initial instint was right, the best way to do this now would be to set the preferred_locale on the Customer in your checkout.session.completed handler.

atomic wave
#

Here is the sample one I used, but I did update the customer manually in the dashboard after (cus_LUhnqTw9kpYN4r). I was trying to see if there was an approach I could take seamlessly when generating the checkout session

fresh lintel
#

After you set it, if the user tries to get their invoice PDF, it will be in their preferred language

#

So they should get communications in their preferred language pretty quickly.

#

I am putting in a feature request to have this done automatically though

atomic wave
#

ok - so with test mode I don't see the emails that would get sent via Stripe - would there end up being an initial email sent out in English before the checkout.session.completed event handling finishes or is there enough of a delay that we would be getting the update done fast enough?

fresh lintel
#

Good question. Not immediately sure. Checking in to this, should have an answer shortly

fresh lintel
#

It looks like the receipt will get sent in the proper locale if it is a Checkout receipt but it may not be set properly if it is a receipt from the Invoice. I couldn't find a Checkout Session with a locale of fr in your live requests so unfortunately I have not been able to confirm this behavior and if setting this setting will influence the first email or not.

atomic wave
#

thanks! I think this gives me enough information to go on for a proposal of what we need to build to start supporting additional languages with our existing solution.