#bazizten

1 messages ยท Page 1 of 1 (latest)

short cargoBOT
fickle flower
#

It should! But not retrosepctively

solid patrol
#

Hmm, cause when I create the customer I do it with preferred_locales: ['sv-SE']

#

Still all my invoices is retrieved with english locale

#

Also tried it in the "Test clock simulator". Same thing

#

I must be missing something ๐Ÿ˜›

fickle flower
#

Can you share an example in_xxx?

solid patrol
#

Swedish is supported. Sorry I have to move away from my desk. Can I write here later?

fickle flower
#

Sure

trail vector
#

I just did a test and sv-SE does work for me at least.

solid patrol
#

Ok. I do not create my invoices manually. They are automatically created by stripe and when I fetch the subsciption and expand the invoice I always get it in english. Let me show a code example:

trail vector
#

thanks, that would be helpful; and also the in_xxx Invoice ID in question

solid patrol
#
const customer = await this.stripe.customers.create({
    name: orgName,
    email: userEmail,
    preferred_locales: ['sv-SE'],
    metadata: { userId, orgId },
});

This is when we create a customer

#
const subscription = await this.stripe.subscriptions.create({
    customer: customerId,
    items: [{ price: this.config.get('STRIPE_PRICE'), quantity: employeeCount }],
    payment_behavior: 'default_incomplete',
    payment_settings: { save_default_payment_method: 'on_subscription' },
    expand: ['latest_invoice.payment_intent'],
    metadata: {
        orgId,
        userId,
    },
});

...and the subscription

#
const subscription = await this.stripe.subscriptions.retrieve(subscriptionId, {
    expand: ['latest_invoice.payment_intent'],
});

const invoice = subscription.latest_invoice as Stripe.Invoice;
const paymentIntent = invoice.payment_intent as Stripe.PaymentIntent;

return {
    subscriptionId: subscription.id,
    clientSecret: paymentIntent.client_secret,
    amountToPay: invoice.amount_remaining,
    items: invoice.lines.data.map((d) => ({
        amount: d.amount,
        description: d.description,
    })),
};
#

...the last code snippet is done just before the user fills in card details. We want to display what the user is paying for in the correct languages

trail vector
#

unfortuantely we don't translate the line item descriptions(you can see the same in my screenshot where it says "One <billing interval> of <name of Product>")

solid patrol
#

Ohhhh. I see...

#

Is there anything I can do instead of this approach

trail vector
#

well you know the amount and the currency and so, you could build your own string representation of the information

solid patrol
#

Yeah the problem is I get items like "Remaining somthing somethin ffrom XX April"

#

Sry I do not remember exactly ๐Ÿ˜› I got it while using the test clock (Which is awesome btw)

trail vector
# solid patrol Yeah the problem is I get items like "Remaining somthing somethin ffrom XX April...

yeah, the generated items for proration are unlocalised, sorry(it's feedback I've raised multiple times over a few years, hasn't been prioritised yet)

You can kind of build your own string I think;. I know proration:true is set on the item, and then https://stripe.com/docs/api/invoices/line_item#invoice_line_item_object-period is the date the proration applies to, from whence you can get the "XX April" information)

solid patrol
#

Alright! I'll try that! Thank so much for taking your time to help me

trail vector
#

oh hmm

#

I think they are translated in the PDF, as of some recent work. The situation in the API is more complicated since it's not really being directly viewed by someone, it's meant to just be the technical description

#

(testing something)

solid patrol
#

๐Ÿฟ

trail vector
#

ah no wait, we didn't. It's if you view the Invoice in the Customer Portal hosted surface, that is localised

#

the PDF and API line item description is still not, sorry. I'll bump the internal ask again