stripe/stripe-java

Cannot set customer preferred_locale when creating Checkout session

Closed this issue · 2 comments

Describe the bug

With the existing APIs I don't see a way to specify in what language invoices should be generated when creating a checkout session for a new customer:

SessionCreateParams.Builder builder = SessionCreateParams.builder()
                .setMode(SessionCreateParams.Mode.SUBSCRIPTION)
                .setSuccessUrl(successURI.toASCIIString())
                .setCancelUrl(cancelURI.toASCIIString())
                .setLocale(SessionCreateParams.Locale.FR)
...               
                .setCustomerEmail(person.getEmail());
                .setSubscriptionData(SessionCreateParams.SubscriptionData.builder().
                    setDescription(duration).
                    build());

        for (OrderItem item : details.getItems()) {
            builder.addLineItem(...);
        }
        try {
            Session session = Session.create(builder.build(), options);

How do we control in what language customer invoices are generated?
If I update the automatically created customer just after the checkout session is created (on customer.created), will the invoice for that checkout be in the correct language?

To Reproduce

Create a Checkout session using the Java APIs.

Expected behavior

The invoice generated should be in French.

Code snippets

No response

OS

macOS

Java version

Java 17

stripe-java version

22.0.0

API version

2022-11-15

Additional context

No response

@franck102 Github issues are limited to bugs or feature requests with the stripe-java library. Your question is an integration support question better directed at our support team and you can contact them here: https://support.stripe.com/contact

To help you here though, if you go through Checkout on a browser with a different locale such as French, Checkout will automatically set preferred_locales on the Customer for you during the Subscription creation and you don't need to do anything special. If you have more questions, our support team will be able to help.

I spent about 1h today with Alec in support, who had no idea the Checkout would be setting the preferred_locale automatically...