20

मेरी ऑनलाइन दुकान में स्ट्रिप को सफलतापूर्वक एकीकृत करने के लिए, मैं पूरी तरह से अंग्रेजी के बजाय जर्मन में त्रुटि संदेशों को वापस करने के लिए स्ट्रिप को कॉन्फ़िगर करने के बारे में जानकारी प्राप्त करने में असफल रहा।स्ट्रिप में गैर-अंग्रेजी ग्रंथ संभव है?

तो मेरे सवाल है:

वहाँ जब क्लाइंट साइड एपीआई "https://js.stripe.com/v2" का उपयोग कर स्थानीय त्रुटि संदेश के लिए कोई तरीका है?

अद्यतन 2014-05-03

मैं ट्विटर पर एक ही सवाल पूछा है और उनके स्टाफ (मुझे लगता है) told me that this is currently not possible में से एक है और उनके TODO सूची में।

उत्तर

53

आगे के संदर्भ के लिए:

आप धारी त्रुटियों पर मानव संदेशों का उपयोग नहीं कर सकते स्थानीय पृष्ठों पर सीधे प्रदर्शित करने के लिए, आप अपने खुद के अनुवाद उपलब्ध कराने के लिए response.error.code का लाभ ले सकते।

var errorMessages = { 
    incorrect_number: "The card number is incorrect.", 
    invalid_number: "The card number is not a valid credit card number.", 
    invalid_expiry_month: "The card's expiration month is invalid.", 
    invalid_expiry_year: "The card's expiration year is invalid.", 
    invalid_cvc: "The card's security code is invalid.", 
    expired_card: "The card has expired.", 
    incorrect_cvc: "The card's security code is incorrect.", 
    incorrect_zip: "The card's zip code failed validation.", 
    card_declined: "The card was declined.", 
    missing: "There is no card on a customer that is being charged.", 
    processing_error: "An error occurred while processing the card.", 
    rate_limit: "An error occurred due to requests hitting the API too quickly. Please let us know if you're consistently running into this error." 
}; 


function stripeHandler(status, response){ 
    if (response.error && response.error.type == 'card_error'){ 
    $('.errors').text(errorMessages[ response.error.code ]); 
    } 

    else { 
    // do other stuff (and handle api/request errors) 
    } 
} 

("कोड" खंड में वर्तमान में, अधिकार स्तम्भ,) कोड is documented here की सूची।

+0

बहुत बहुत धन्यवाद! मैं इसे उत्तर के रूप में चिह्नित करूंगा :-) –

+2

पूरी तरह से काम करता है –

+1

महान उत्तर! :) – facundofarias

संबंधित मुद्दे