Skip to content

translations for the stripe.com declines codes as npm package

License

Notifications You must be signed in to change notification settings

tevim/stripe-i18n-declined-codes

Repository files navigation

stripe-i18n-declined-codes

This npm package contains translations for all stripe.com declined codes that the user can fix. Checkout the stripe readme @ https://stripe.com/docs/declines/codes and the wiki @ https://github.com/stripe/stripe-node/wiki/Error-Handling

Installation

Install the package with:

$ yarn add stripe-i18n-declined-codes

Usage Example

import Stripe from 'stripe'
import { EN_TRANSLATIONS } from 'stripe-i18n-declined-codes'

const stripe = new Stripe(STRIPE_SECRET_KEY)
stripe.charges.create({
  amount: 995,
  // ...
}).then(
  function (result) {},
  function (err) {
    if(err.type === 'StripeCardError') {
      return EN_TRANSLATIONS[err.code] || ' ... generic payment error occured'
    }
    // ...
  }
)

Supported Languages

This package supports the following languages as exports:

import { DE_TRANSLATIONS } from 'stripe-i18n-declined-codes'
import { EN_TRANSLATIONS } from 'stripe-i18n-declined-codes'
import { ES_TRANSLATIONS } from 'stripe-i18n-declined-codes'
import { FR_TRANSLATIONS } from 'stripe-i18n-declined-codes'

Development

Run all tests:

$ yarn install
$ yarn test

About

translations for the stripe.com declines codes as npm package

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published