#mjbc

1 messages · Page 1 of 1 (latest)

thorn trailBOT
tough ermine
bitter shuttle
#

oh, no, that's not what I meant, and yeah, I'm aware of the locale option, it's used by the localizeError function, I mean getting a localizedError message on demand, as in not in the flow of a confirmCardPayment, for example.

tough ermine
#

No that is not possible

bitter shuttle
#

As in if I have an error code from a previous interaction and want to tell the user, later on, even on another device, what the error was. I was told earlier that it's not possible, even though it is, i'm asking if that function is not for the public consumption

#

ok, so it's a private method, and I shouldn't rely on it being available in a future release

#

(it is in fact available)

#

but since it's not document, and the "_controller" starts with "_" i'm assuming it's private

tough ermine
#

Yeah if we don't document it then it should not be relied upon and we may change and/or remove it at any time (we push updates to Stripe.js daily)

bitter shuttle
#

gotcha. too bad, this functionality would be amazing to show users previous errors in customs workflows

#

is there a place to make suggestions?

tough ermine
#

So, just to be clear, you want to not localize all of Stripe.js for a given client interaction but you do want to localize a single specific error message? I'm afraid I'm having a hard time understanding when that would be desirable

bitter shuttle
#

no no

#

we have a custom flow, and even if the payment fails, we still create an order and payment object, and later on, or in another device the user can check the state of their order, and the info about the payment state

#

and at that point we'll ask for new card details, but we shouldn't just show that without saying what happened, why it failed. I know it's a sync'ed request and we can show the user what's went wrong in the moment, but we want to have that info to show the user later as well

#

the webhook reports the error code as well, so we save it on our stripe payment object (internal) and can access that information later on, but if we can't rely on stripe.js to convert an error code into a message we'll have to do it by hand. too bad

tough ermine
#

So you store the error message itself in your system and want to use Stripe.js to translate after-the-fact?

bitter shuttle
#

well, kind of. Since there's no API call to do that so I could store it in the user's language, I was thinking if stripe.js had that function, since it already translates the errors depending on the locale. I store the error code as reported by the webhook

#

our backend is agnostic to what happened in the frontend, only what the webhook tells it what happened

#

so I would have two ways of telling the user what went wrong, while asking for them to reintroduce their card details to finish the payment: either I translate all possible errors for all the languages we support now (and in the future) or I could, in runtime, ask stripe.js to translate the error code.

#

but I guess the manual translation on our side is the only way

tough ermine
bitter shuttle
#

oh, yeah, but I would still have to have the translations somewhere, since the webhook always sends the message in english.

#

I know which language my users are using, I just wanted to leverage stripe.js to accomplish the translation since it already does it in other contexts/flows. I guess I can send the error to the backend after it occurs on the front end and what the message is for a certain language.

#

maybe in the future Stripe could rethink this option. Well, thank you for your time