When using card on file to add new cards, after submitting the form I get all the error messages in English. It would be nice to make these messages translatable to different languages possibly using the t() function from Drupal.

I know the code is in jQuery and that it is a get function, so I dunno how to apply php functionality inside, but still, it would be nice to create some sort of system to allow site builders to change the messages returned by stripe.

Thanks!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

aviindub’s picture

Version: 7.x-1.0-rc7 » 7.x-2.x-dev
Status: Active » Needs work

sounds like a reasonable feature for 2.0

garen24’s picture

Looking forward to it. Thanks!

Jehu’s picture

I've created a patch on base of version 7.x-1.x

torgosPizza’s picture

Version: 7.x-2.x-dev » 7.x-1.x-dev
Status: Needs work » Needs review

I think 2.x is shelved (For now anyway) so setting it back and setting to Needs review.

Kingdutch’s picture

Version: 7.x-1.x-dev » 7.x-3.x-dev
FileSize
1.9 KB

Moving to 3.x as it seems more alive than 1.x

It also seems that in the Stripe API the error.code has been replaced by error.type. Furthermore the error I encounter is:

message: "Could not find payment information"
type: "invalid_request_error"

In the attached patch the above error type with message has been added to what Jehu did in #3. What will need to be checked is whether the other types are still correct in the latest API version.

Kingdutch’s picture

It turns out that the response from Stripe contains a type and sometimes a code if there are multiple different messages within the same type. Two examples below.

Object
code: "invalid_number"
message: "The card number is not a valid credit card number."
param: "number"
type: "card_error"

Object
message: "Could not find payment information"
type: "invalid_request_error"

So we first check if there's a specific code and fall back to the type otherwise.

shi99’s picture

Patch in #6 worked for me.

Thanks.

Alex Bukach’s picture

Patch in #6 worked for me as well. Thanks!

torgosPizza’s picture

Status: Needs review » Fixed

Thanks, everyone! Committed to dev.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.