stripe-decline-codes 0.2.0 โ 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -6
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +52 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +39 -31
- package/dist/index.mjs.map +1 -1
- package/dist/types.d.ts +11 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +12 -4
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ A lightweight, zero-dependency TypeScript library providing human-readable descr
|
|
|
9
9
|
|
|
10
10
|
## Features
|
|
11
11
|
|
|
12
|
-
- ๐ฏ **Complete Coverage** - All
|
|
12
|
+
- ๐ฏ **Complete Coverage** - All 43 Stripe decline codes included
|
|
13
13
|
- ๐ **Localization** - Built-in English and Japanese translations
|
|
14
14
|
- ๐ **TypeScript Support** - Full type definitions included
|
|
15
15
|
- ๐ชถ **Zero Dependencies** - Lightweight and fast
|
|
@@ -89,7 +89,7 @@ isValidDeclineCode('invalid_code'); // => false
|
|
|
89
89
|
import { getAllDeclineCodes } from 'stripe-decline-codes';
|
|
90
90
|
|
|
91
91
|
const codes = getAllDeclineCodes();
|
|
92
|
-
console.log(codes.length); // =>
|
|
92
|
+
console.log(codes.length); // => 43
|
|
93
93
|
console.log(codes);
|
|
94
94
|
// => ['approve_with_id', 'call_issuer', 'card_not_supported', ...]
|
|
95
95
|
```
|
|
@@ -176,6 +176,34 @@ try {
|
|
|
176
176
|
}
|
|
177
177
|
```
|
|
178
178
|
|
|
179
|
+
### Typed Error Narrowing
|
|
180
|
+
|
|
181
|
+
Narrow an unknown caught error to one carrying a known `DeclineCode`:
|
|
182
|
+
|
|
183
|
+
```typescript
|
|
184
|
+
import { isStripeDeclineError, getDeclineCodeFromError, isSoftDecline } from 'stripe-decline-codes';
|
|
185
|
+
|
|
186
|
+
try {
|
|
187
|
+
const charge = await stripe.charges.create({ ... });
|
|
188
|
+
} catch (err) {
|
|
189
|
+
// Type guard โ inside this block err.decline_code is typed as DeclineCode
|
|
190
|
+
if (isStripeDeclineError(err)) {
|
|
191
|
+
console.log(err.decline_code); // DeclineCode (not just string)
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// Or extract the validated code directly from any caught value
|
|
195
|
+
const code = getDeclineCodeFromError(err); // DeclineCode | undefined
|
|
196
|
+
if (code && isSoftDecline(code)) {
|
|
197
|
+
// safe to retry
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
The narrowing assumes the `stripe-node` >= 18 error shape, where
|
|
203
|
+
`StripeCardError.decline_code` is a required `string`. Errors from
|
|
204
|
+
`stripe-node` <= 17 or plain objects fall back to the same runtime check, so
|
|
205
|
+
they work identically โ only `decline_code` may be absent.
|
|
206
|
+
|
|
179
207
|
## API Reference
|
|
180
208
|
|
|
181
209
|
### Core Functions
|
|
@@ -263,19 +291,31 @@ Checks if a decline code is a soft decline (temporary, can retry).
|
|
|
263
291
|
|
|
264
292
|
### Stripe Error Integration
|
|
265
293
|
|
|
266
|
-
#### `getMessageFromStripeError(error:
|
|
294
|
+
#### `getMessageFromStripeError(error: unknown, locale?: Locale): string | undefined`
|
|
267
295
|
|
|
268
|
-
Extracts a localized user-facing message directly from a Stripe error object.
|
|
296
|
+
Extracts a localized user-facing message directly from a Stripe error object. Accepts any caught value; returns `undefined` for non-object inputs or missing/unknown decline codes.
|
|
269
297
|
|
|
270
298
|
**Parameters:**
|
|
271
|
-
- `error` - The Stripe error object
|
|
299
|
+
- `error` - The Stripe error object (or any caught value)
|
|
272
300
|
- `locale` - The locale to use (`'en'` or `'ja'`, default: `'en'`)
|
|
273
301
|
|
|
274
302
|
**Returns:** User-facing message in the specified locale, or undefined if no decline code is present
|
|
275
303
|
|
|
304
|
+
#### `isStripeDeclineError(error: unknown): error is StripeDeclineError`
|
|
305
|
+
|
|
306
|
+
Type guard that checks whether an unknown value is an object carrying a known decline code. Inside the guarded block, `error.decline_code` is typed as `DeclineCode`.
|
|
307
|
+
|
|
308
|
+
**Returns:** `true` if the value has a `decline_code` matching a known `DeclineCode`, `false` otherwise
|
|
309
|
+
|
|
310
|
+
#### `getDeclineCodeFromError(error: unknown): DeclineCode | undefined`
|
|
311
|
+
|
|
312
|
+
Extracts a validated decline code from any caught value. Returns `undefined` when the value has no decline code or an unrecognized one (e.g. a code newly added by Stripe).
|
|
313
|
+
|
|
314
|
+
**Returns:** The decline code typed as `DeclineCode`, or `undefined`
|
|
315
|
+
|
|
276
316
|
## Supported Decline Codes
|
|
277
317
|
|
|
278
|
-
This library includes all
|
|
318
|
+
This library includes all 43 Stripe decline codes:
|
|
279
319
|
|
|
280
320
|
- `approve_with_id` - Payment cannot be authorized
|
|
281
321
|
- `call_issuer` - Card declined for unknown reason
|
|
@@ -321,6 +361,29 @@ This library includes all 44 Stripe decline codes:
|
|
|
321
361
|
- `try_again_later` - Card declined, try again later
|
|
322
362
|
- `withdrawal_count_limit_exceeded` - Credit limit exceeded
|
|
323
363
|
|
|
364
|
+
## Compatibility
|
|
365
|
+
|
|
366
|
+
| Environment | Support |
|
|
367
|
+
| --- | --- |
|
|
368
|
+
| Node.js | >= 18 (tested on 18.x / 20.x / 22.x in CI) |
|
|
369
|
+
| Cloudflare Workers (workerd) | Verified via [@cloudflare/vitest-plugin](https://developers.cloudflare.com/workers/testing/vitest-integration/) runtime tests |
|
|
370
|
+
| Other edge runtimes (Deno, Bun) | Should work (pure TypeScript, zero dependencies) but not CI-verified |
|
|
371
|
+
| Module formats | ESM (`index.mjs`), CJS (`index.cjs`), TypeScript types (`index.d.ts`) |
|
|
372
|
+
|
|
373
|
+
### Stripe SDK compatibility
|
|
374
|
+
|
|
375
|
+
This package has **no dependency** on the `stripe` package. The `StripeError`
|
|
376
|
+
type accepted by `getMessageFromStripeError` is a structural interface, so it
|
|
377
|
+
works with error objects from any `stripe-node` version โ and with plain
|
|
378
|
+
objects such as `JSON.parse`d API responses.
|
|
379
|
+
|
|
380
|
+
The helpers are designed against the `stripe-node` **>= 18** error shape, in
|
|
381
|
+
which `StripeCardError.decline_code` is a required `string`. On `stripe-node`
|
|
382
|
+
**<= 17** (where `decline_code` is optional) errors still type-check and run
|
|
383
|
+
correctly via the structural fallback โ the only difference is that
|
|
384
|
+
`decline_code` may be `undefined`, which the helpers already handle by
|
|
385
|
+
returning `undefined`.
|
|
386
|
+
|
|
324
387
|
## TypeScript
|
|
325
388
|
|
|
326
389
|
This library is written in TypeScript and includes full type definitions:
|
|
@@ -334,6 +397,7 @@ import type {
|
|
|
334
397
|
Translation,
|
|
335
398
|
DeclineCategory,
|
|
336
399
|
StripeError,
|
|
400
|
+
StripeDeclineError,
|
|
337
401
|
} from 'stripe-decline-codes';
|
|
338
402
|
```
|
|
339
403
|
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o="2024-12-18",r={approve_with_id:{description:"The payment cannot be authorized.",nextSteps:"The payment should be attempted again. If it still cannot be processed, the customer needs to contact their card issuer.",nextUserAction:"Please try again. If it still cannot be processed, the please contact your card issuer.",category:"SOFT_DECLINE",translations:{ja:{description:"ๆฏๆใใฏๆฟ่ชใงใใพใใใ",nextUserAction:"ใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},call_issuer:{description:"The card has been declined for an unknown reason.",nextSteps:"The customer needs to contact their card issuer for more information.",nextUserAction:"Please contact your card issuer for more information.",category:"SOFT_DECLINE",translations:{ja:{description:"ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},card_not_supported:{description:"The card does not support this type of purchase.",nextSteps:"The customer needs to contact their card issuer to make sure their card can be used to make this type of purchase.",nextUserAction:"Your card issuer may not support this type of purchase, please contact your card issuer for more information.",category:"HARD_DECLINE",translations:{ja:{description:"ใซใผใใฏใใฎใฟใคใใฎ่ณผๅ
ฅใใตใใผใใใพใใใ",nextUserAction:"ใซใผใ็บ่ก่
ใฏใใฎใฟใคใใฎ่ณผๅ
ฅใใตใใผใใใฆใใชใๅฏ่ฝๆงใใใใพใใ่ฉณ็ดฐใซใคใใฆใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},card_velocity_exceeded:{description:"The customer has exceeded the balance or credit limit available on their card.",nextSteps:"The customer should contact their card issuer for more information.",nextUserAction:"Please contact your card issuer for more information.",category:"SOFT_DECLINE",translations:{ja:{description:"ใใฎใซใผใใฎๆฎ้ซใพใใฏใฏใฌใธใใๅถ้ใ่ถ
ใใพใใใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},currency_not_supported:{description:"The card does not support the specified currency.",nextSteps:"The customer needs to check with the issuer whether the card can be used for the type of currency specified.",nextUserAction:"Please contact your card issuer to verify this type of currency can be used for this payment.",category:"HARD_DECLINE",translations:{ja:{description:"ใซใผใใฏๆๅฎใใใ้่ฒจใใตใใผใใใฆใใพใใใ",nextUserAction:"ใใฎๆฏๆใใซใใฎใฟใคใใฎ้่ฒจใไฝฟ็จใงใใใใจใ็ขบ่ชใใใซใฏใใซใผใ็บ่กไผ็คพใซ้ฃ็ตกใใฆใใ ใใใ"}}},do_not_honor:{description:"The card has been declined for an unknown reason.",nextSteps:"The customer needs to contact their card issuer for more information.",nextUserAction:"Please contact your card issuer for more information.",category:"SOFT_DECLINE",translations:{ja:{description:"ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},do_not_try_again:{description:"The card has been declined for an unknown reason.",nextSteps:"The customer should contact their card issuer for more information.",nextUserAction:"Please contact your card issuer for more information.",category:"HARD_DECLINE",translations:{ja:{description:"ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},duplicate_transaction:{description:"A transaction with identical amount and credit card information was submitted very recently.",nextSteps:"Check to see if a recent payment already exists.",nextUserAction:"Check to see if a recent payment already exists.",category:"SOFT_DECLINE",translations:{ja:{description:"ใใๆ่ฟใๅไธใฎ้้กใจใฏใฌใธใใใซใผใๆ
ๅ ฑใไฝฟ็จใใๅๅผใ้ไฟกใใใพใใใ",nextUserAction:"ๆ่ฟใฎๆฏๆใใๆขใซๅญๅจใใใใฉใใใ็ขบ่ชใใฆใใ ใใใ"}}},expired_card:{description:"The card has expired.",nextSteps:"The customer should use another card.",nextUserAction:"Please use another card.",category:"HARD_DECLINE",translations:{ja:{description:"ใซใผใใฏๆ้ๅใใงใใ",nextUserAction:"ๅฅใฎใซใผใใไฝฟ็จใใฆใใ ใใใ"}}},fraudulent:{description:"The payment has been declined as Stripe suspects it is fraudulent.",nextSteps:"Do not report more detailed information to your customer. Instead, present as you would the generic_decline described below.",nextUserAction:"Please contact your card issuer for more information.",category:"HARD_DECLINE",translations:{ja:{description:"ไธๆญฃใจๆใใใใใใๆฏๆใใฏๆๅฆใใใพใใใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},generic_decline:{description:"The card has been declined for an unknown reason.",nextSteps:"The customer needs to contact their card issuer for more information.",nextUserAction:"Please contact your card issuer for more information.",category:"SOFT_DECLINE",translations:{ja:{description:"ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},incorrect_number:{description:"The card number is incorrect.",nextSteps:"The customer should try again using the correct card number.",nextUserAction:"Please check your card numbers and try again. If it still cannot be processed, the please contact your card issuer.",category:"HARD_DECLINE",translations:{ja:{description:"ใซใผใ็ชๅทใๆญฃใใใใใพใใใ",nextUserAction:"ใซใผใ็ชๅทใ็ขบ่ชใใฆใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},incorrect_cvc:{description:"The CVC number is incorrect.",nextSteps:"The customer should try again using the correct CVC.",nextUserAction:"Please check your card numbers and try again. If it still cannot be processed, the please contact your card issuer.",category:"HARD_DECLINE",translations:{ja:{description:"CVC็ชๅทใๆญฃใใใใใพใใใ",nextUserAction:"CSC็ชๅทใ็ขบ่ชใใฆใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},incorrect_pin:{description:"The PIN entered is incorrect. This decline code only applies to payments made with a card reader.",nextSteps:"The customer should try again using the correct PIN.",nextUserAction:"Please check your PIN and try again. If it still cannot be processed, the please contact your card issuer.",category:"HARD_DECLINE",translations:{ja:{description:"PINใณใผใใๆญฃใใใใใพใใใ",nextUserAction:"PINใณใผใใ็ขบ่ชใใฆใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},incorrect_zip:{description:"The ZIP/postal code is incorrect.",nextSteps:"The customer should try again using the correct billing ZIP/postal code.",nextUserAction:"Please try again using the correct ZIP/postal code.",category:"HARD_DECLINE",translations:{ja:{description:"้ตไพฟ็ชๅทใๆญฃใใใใใพใใใ",nextUserAction:"ๆญฃใใ้ตไพฟ็ชๅทใไฝฟ็จใใฆใใไธๅบฆใ่ฉฆใใใ ใใใ"}}},insufficient_funds:{description:"The card has insufficient funds to complete the purchase.",nextSteps:"The customer should use an alternative payment method.",nextUserAction:"Please try again using an alternative payment method.",category:"SOFT_DECLINE",translations:{ja:{description:"ใซใผใใฎ่ณผๅ
ฅใซๅฟ
่ฆใช่ณ้ใไธ่ถณใใฆใใพใใ",nextUserAction:"ๅฅใฎใๆฏๆใๆนๆณใไฝฟ็จใใฆใใไธๅบฆใ่ฉฆใใใ ใใใ"}}},invalid_account:{description:"The card, or account the card is connected to, is invalid.",nextSteps:"The customer needs to contact their card issuer to check that the card is working correctly.",nextUserAction:"Please contact your card issuer for more information.",category:"HARD_DECLINE",translations:{ja:{description:"ใซใผใใใพใใฏใซใผใใๆฅ็ถใใใฆใใใขใซใฆใณใใ็กๅนใงใใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},invalid_amount:{description:"The payment amount is invalid, or exceeds the amount that is allowed.",nextSteps:"If the amount appears to be correct, the customer needs to check with their card issuer that they can make purchases of that amount.",nextUserAction:"Please contact your card issuer for more information.",category:"SOFT_DECLINE",translations:{ja:{description:"ๆฏๆใ้้กใ็กๅนใงใใใใ่จฑๅฏใใใฆใใ้้กใ่ถ
ใใฆใใพใใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},invalid_cvc:{description:"The CVC number is incorrect.",nextSteps:"The customer should try again using the correct CVC.",nextUserAction:"Please try again using the correct CVC.",category:"HARD_DECLINE",translations:{ja:{description:"CVC็ชๅทใๆญฃใใใใใพใใใ",nextUserAction:"ๆญฃใใCVCใไฝฟ็จใใฆใใไธๅบฆใใ็ดใใฆใใ ใใใ"}}},invalid_expiry_year:{description:"The expiration year invalid.",nextSteps:"The customer should try again using the correct expiration date.",nextUserAction:"Please try again using the correct expiration date.",category:"HARD_DECLINE",translations:{ja:{description:"ๆๅนๆ้ใ็กๅนใงใใ",nextUserAction:"ๆญฃใใๆๅนๆ้ใๅ
ฅๅใใฆใใไธๅบฆใ่ฉฆใใใ ใใใ"}}},invalid_number:{description:"The card number is incorrect.",nextSteps:"The customer should try again using the correct card number.",nextUserAction:"Please try again using the correct card number.",category:"HARD_DECLINE",translations:{ja:{description:"ใซใผใ็ชๅทใๆญฃใใใใใพใใใ",nextUserAction:"ๆญฃใใใซใผใ็ชๅทใไฝฟ็จใใฆใใไธๅบฆใใ็ดใใฆใใ ใใใ"}}},invalid_pin:{description:"The PIN entered is incorrect. This decline code only applies to payments made with a card reader.",nextSteps:"The customer should try again using the correct PIN.",nextUserAction:"Please try again using the correct card PIN.",category:"HARD_DECLINE",translations:{ja:{description:"PINใณใผใใๆญฃใใใใใพใใใ",nextUserAction:"ๆญฃใใPINใณใผใใไฝฟ็จใใฆใใไธๅบฆใใ็ดใใฆใใ ใใใ"}}},issuer_not_available:{description:"The card issuer could not be reached, so the payment could not be authorized.",nextSteps:"The payment should be attempted again. If it still cannot be processed, the customer needs to contact their card issuer.",nextUserAction:"Please try again. If it still cannot be processed, the please contact your card issuer.",category:"SOFT_DECLINE",translations:{ja:{description:"ใซใผใ็บ่ก่
ใซ้ฃ็ตกใงใใชใใฃใใใใๆฏๆใใๆฟ่ชใงใใพใใใงใใใ",nextUserAction:"ใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},lost_card:{description:"The payment has been declined because the card is reported lost.",nextSteps:"The specific reason for the decline should not be reported to the customer. Instead, it needs to be presented as a generic decline.",nextUserAction:"Please contact your card issuer for more information.",category:"HARD_DECLINE",translations:{ja:{description:"ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},merchant_blacklist:{description:"The payment has been declined because it matches a value on the Stripe user's blocklist.",nextSteps:"Do not report more detailed information to your customer. Instead, present as you would the generic_decline described above.",nextUserAction:"Please contact your card issuer for more information.",category:"HARD_DECLINE",translations:{ja:{description:"ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},new_account_information_available:{description:"The card, or account the card is connected to, is invalid.",nextSteps:"The customer needs to contact their card issuer for more information.",nextUserAction:"Please contact your card issuer for more information.",category:"SOFT_DECLINE",translations:{ja:{description:"ใซใผใใใพใใฏใซใผใใๆฅ็ถใใใฆใใใขใซใฆใณใใ็กๅนใงใใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},no_action_taken:{description:"The card has been declined for an unknown reason.",nextSteps:"The customer should contact their card issuer for more information.",nextUserAction:"Please contact your card issuer for more information.",category:"SOFT_DECLINE",translations:{ja:{description:"ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},not_permitted:{description:"The payment is not permitted.",nextSteps:"The customer needs to contact their card issuer for more information.",nextUserAction:"Please contact your card issuer for more information.",category:"HARD_DECLINE",translations:{ja:{description:"ๆฏๆใใฏ่จฑๅฏใใใฆใใพใใใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},pickup_card:{description:"The card cannot be used to make this payment (it is possible it has been reported lost or stolen).",nextSteps:"The customer needs to contact their card issuer for more information.",nextUserAction:"Please contact your card issuer for more information.",category:"HARD_DECLINE",translations:{ja:{description:"ใซใผใใงใใฎๆฏๆใใ่กใใใจใฏใงใใพใใ๏ผ็ดๅคฑใพใใฏ็้ฃใซใใฃใใจๅ ฑๅใใใฆใใๅฏ่ฝๆงใใใใพใ๏ผใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},pin_try_exceeded:{description:"The allowable number of PIN tries has been exceeded.",nextSteps:"The customer must use another card or method of payment.",nextUserAction:"Please use another card or method of payment.",category:"SOFT_DECLINE",translations:{ja:{description:"PIN่ฉฆ่กๅๆฐใฎไธ้ใ่ถ
ใใพใใใ",nextUserAction:"ๅฅใฎใซใผใใพใใฏใๆฏๆใๆนๆณใใๅฉ็จใใ ใใใ"}}},processing_error:{description:"An error occurred while processing the card.",nextSteps:"The payment should be attempted again. If it still cannot be processed, try again later.",nextUserAction:"Please try again. If it still cannot be processed, the please contact your card issuer.",category:"SOFT_DECLINE",translations:{ja:{description:"ใซใผใใฎๅฆ็ไธญใซใจใฉใผใ็บ็ใใพใใใ",nextUserAction:"ใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},reenter_transaction:{description:"The payment could not be processed by the issuer for an unknown reason.",nextSteps:"The payment should be attempted again. If it still cannot be processed, the customer needs to contact their card issuer.",nextUserAction:"Please try again. If it still cannot be processed, the please contact your card issuer.",category:"SOFT_DECLINE",translations:{ja:{description:"ๅๅ ไธๆใฎใใใ็บ่ก่
ใๆฏๆใใๅฆ็ใงใใพใใใงใใใ",nextUserAction:"ใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},restricted_card:{description:"The card cannot be used to make this payment (it is possible it has been reported lost or stolen).",nextSteps:"The customer needs to contact their card issuer for more information.",nextUserAction:"Please contact your card issuer for more information.",category:"HARD_DECLINE",translations:{ja:{description:"ใซใผใใงใใฎๆฏๆใใ่กใใใจใฏใงใใพใใ๏ผ็ดๅคฑใพใใฏ็้ฃใซใใฃใใจๅ ฑๅใใใฆใใๅฏ่ฝๆงใใใใพใ๏ผใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},revocation_of_all_authorizations:{description:"The card has been declined for an unknown reason.",nextSteps:"The customer should contact their card issuer for more information.",nextUserAction:"Please contact your card issuer for more information.",category:"HARD_DECLINE",translations:{ja:{description:"ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},revocation_of_authorization:{description:"The card has been declined for an unknown reason.",nextSteps:"The customer should contact their card issuer for more information.",nextUserAction:"Please contact your card issuer for more information.",category:"HARD_DECLINE",translations:{ja:{description:"ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},security_violation:{description:"The card has been declined for an unknown reason.",nextSteps:"The customer needs to contact their card issuer for more information.",nextUserAction:"Please contact your card issuer for more information.",category:"HARD_DECLINE",translations:{ja:{description:"ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},service_not_allowed:{description:"The card has been declined for an unknown reason.",nextSteps:"The customer should contact their card issuer for more information.",nextUserAction:"Please contact your card issuer for more information.",category:"HARD_DECLINE",translations:{ja:{description:"ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},stolen_card:{description:"The payment has been declined because the card is reported stolen.",nextSteps:"The specific reason for the decline should not be reported to the customer. Instead, it needs to be presented as a generic decline.",nextUserAction:"Please contact your card issuer for more information.",category:"HARD_DECLINE",translations:{ja:{description:"ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},stop_payment_order:{description:"The card has been declined for an unknown reason.",nextSteps:"The customer should contact their card issuer for more information.",nextUserAction:"Please contact your card issuer for more information.",category:"HARD_DECLINE",translations:{ja:{description:"ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},testmode_decline:{description:"A Stripe test card number was used.",nextSteps:"A genuine card must be used to make a payment.",nextUserAction:"A genuine card must be used to make a payment.",category:"HARD_DECLINE",translations:{ja:{description:"Stripeใในใใซใผใ็ชๅทใไฝฟ็จใใพใใใ",nextUserAction:"ๆฏๆใใซใฏๆฌ็ฉใฎใซใผใใไฝฟ็จใใๅฟ
่ฆใใใใพใใ"}}},transaction_not_allowed:{description:"The card has been declined for an unknown reason.",nextSteps:"The customer needs to contact their card issuer for more information.",nextUserAction:"Please contact your card issuer for more information.",category:"HARD_DECLINE",translations:{ja:{description:"ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},try_again_later:{description:"The card has been declined for an unknown reason.",nextSteps:"Ask the customer to attempt the payment again. If subsequent payments are declined, the customer should contact their card issuer for more information.",nextUserAction:"Please try again. If it still cannot be processed, the please contact your card issuer.",category:"SOFT_DECLINE",translations:{ja:{description:"ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ",nextUserAction:"ใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},withdrawal_count_limit_exceeded:{description:"The customer has exceeded the balance or credit limit available on their card.",nextSteps:"The customer should use an alternative payment method.",nextUserAction:"Please use another card or contact your card issuer for more information.",category:"SOFT_DECLINE",translations:{ja:{description:"ใใฎใซใผใใฎๆฎ้ซใพใใฏใฏใฌใธใใๅถ้ใ่ถ
ใใพใใใ",nextUserAction:"ๅฅใฎใซใผใใไฝฟ็จใใใใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}}};function m(e){if(!e||!s(e))return{docVersion:o,code:{}};const t=r[e];return{docVersion:o,code:t}}function c(e,t="en"){if(!s(e))return;const n=r[e];return t==="en"?n.nextUserAction:n.translations?.[t]?.nextUserAction}function y(){return Object.keys(r)}function s(e){return Object.hasOwn(r,e)}function f(){return o}function x(e,t="en",n){const i=c(e,t);if(!i)return;if(!n||Object.keys(n).length===0)return i;let a=i;for(const[u,l]of Object.entries(n)){const p=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),h=new RegExp(`\\{\\{${p}\\}\\}`,"g");a=a.replace(h,l)}return a}function d(e){if(s(e))return r[e].category}function g(e){return d(e)==="HARD_DECLINE"}function A(e){return d(e)==="SOFT_DECLINE"}function _(e,t="en"){if(e.decline_code)return c(e.decline_code,t)}exports.DECLINE_CODES=r;exports.DOC_VERSION=o;exports.formatDeclineMessage=x;exports.getAllDeclineCodes=y;exports.getDeclineCategory=d;exports.getDeclineDescription=m;exports.getDeclineMessage=c;exports.getDocVersion=f;exports.getMessageFromStripeError=_;exports.isHardDecline=g;exports.isSoftDecline=A;exports.isValidDeclineCode=s;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s="2024-12-18",r={approve_with_id:{description:"The payment cannot be authorized.",nextSteps:"The payment should be attempted again. If it still cannot be processed, the customer needs to contact their card issuer.",nextUserAction:"Please try again. If it still cannot be processed, the please contact your card issuer.",category:"SOFT_DECLINE",translations:{ja:{description:"ๆฏๆใใฏๆฟ่ชใงใใพใใใ",nextUserAction:"ใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},call_issuer:{description:"The card has been declined for an unknown reason.",nextSteps:"The customer needs to contact their card issuer for more information.",nextUserAction:"Please contact your card issuer for more information.",category:"SOFT_DECLINE",translations:{ja:{description:"ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},card_not_supported:{description:"The card does not support this type of purchase.",nextSteps:"The customer needs to contact their card issuer to make sure their card can be used to make this type of purchase.",nextUserAction:"Your card issuer may not support this type of purchase, please contact your card issuer for more information.",category:"HARD_DECLINE",translations:{ja:{description:"ใซใผใใฏใใฎใฟใคใใฎ่ณผๅ
ฅใใตใใผใใใพใใใ",nextUserAction:"ใซใผใ็บ่ก่
ใฏใใฎใฟใคใใฎ่ณผๅ
ฅใใตใใผใใใฆใใชใๅฏ่ฝๆงใใใใพใใ่ฉณ็ดฐใซใคใใฆใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},card_velocity_exceeded:{description:"The customer has exceeded the balance or credit limit available on their card.",nextSteps:"The customer should contact their card issuer for more information.",nextUserAction:"Please contact your card issuer for more information.",category:"SOFT_DECLINE",translations:{ja:{description:"ใใฎใซใผใใฎๆฎ้ซใพใใฏใฏใฌใธใใๅถ้ใ่ถ
ใใพใใใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},currency_not_supported:{description:"The card does not support the specified currency.",nextSteps:"The customer needs to check with the issuer whether the card can be used for the type of currency specified.",nextUserAction:"Please contact your card issuer to verify this type of currency can be used for this payment.",category:"HARD_DECLINE",translations:{ja:{description:"ใซใผใใฏๆๅฎใใใ้่ฒจใใตใใผใใใฆใใพใใใ",nextUserAction:"ใใฎๆฏๆใใซใใฎใฟใคใใฎ้่ฒจใไฝฟ็จใงใใใใจใ็ขบ่ชใใใซใฏใใซใผใ็บ่กไผ็คพใซ้ฃ็ตกใใฆใใ ใใใ"}}},do_not_honor:{description:"The card has been declined for an unknown reason.",nextSteps:"The customer needs to contact their card issuer for more information.",nextUserAction:"Please contact your card issuer for more information.",category:"SOFT_DECLINE",translations:{ja:{description:"ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},do_not_try_again:{description:"The card has been declined for an unknown reason.",nextSteps:"The customer should contact their card issuer for more information.",nextUserAction:"Please contact your card issuer for more information.",category:"HARD_DECLINE",translations:{ja:{description:"ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},duplicate_transaction:{description:"A transaction with identical amount and credit card information was submitted very recently.",nextSteps:"Check to see if a recent payment already exists.",nextUserAction:"Check to see if a recent payment already exists.",category:"SOFT_DECLINE",translations:{ja:{description:"ใใๆ่ฟใๅไธใฎ้้กใจใฏใฌใธใใใซใผใๆ
ๅ ฑใไฝฟ็จใใๅๅผใ้ไฟกใใใพใใใ",nextUserAction:"ๆ่ฟใฎๆฏๆใใๆขใซๅญๅจใใใใฉใใใ็ขบ่ชใใฆใใ ใใใ"}}},expired_card:{description:"The card has expired.",nextSteps:"The customer should use another card.",nextUserAction:"Please use another card.",category:"HARD_DECLINE",translations:{ja:{description:"ใซใผใใฏๆ้ๅใใงใใ",nextUserAction:"ๅฅใฎใซใผใใไฝฟ็จใใฆใใ ใใใ"}}},fraudulent:{description:"The payment has been declined as Stripe suspects it is fraudulent.",nextSteps:"Do not report more detailed information to your customer. Instead, present as you would the generic_decline described below.",nextUserAction:"Please contact your card issuer for more information.",category:"HARD_DECLINE",translations:{ja:{description:"ไธๆญฃใจๆใใใใใใๆฏๆใใฏๆๅฆใใใพใใใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},generic_decline:{description:"The card has been declined for an unknown reason.",nextSteps:"The customer needs to contact their card issuer for more information.",nextUserAction:"Please contact your card issuer for more information.",category:"SOFT_DECLINE",translations:{ja:{description:"ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},incorrect_number:{description:"The card number is incorrect.",nextSteps:"The customer should try again using the correct card number.",nextUserAction:"Please check your card numbers and try again. If it still cannot be processed, the please contact your card issuer.",category:"HARD_DECLINE",translations:{ja:{description:"ใซใผใ็ชๅทใๆญฃใใใใใพใใใ",nextUserAction:"ใซใผใ็ชๅทใ็ขบ่ชใใฆใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},incorrect_cvc:{description:"The CVC number is incorrect.",nextSteps:"The customer should try again using the correct CVC.",nextUserAction:"Please check your card numbers and try again. If it still cannot be processed, the please contact your card issuer.",category:"HARD_DECLINE",translations:{ja:{description:"CVC็ชๅทใๆญฃใใใใใพใใใ",nextUserAction:"CSC็ชๅทใ็ขบ่ชใใฆใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},incorrect_pin:{description:"The PIN entered is incorrect. This decline code only applies to payments made with a card reader.",nextSteps:"The customer should try again using the correct PIN.",nextUserAction:"Please check your PIN and try again. If it still cannot be processed, the please contact your card issuer.",category:"HARD_DECLINE",translations:{ja:{description:"PINใณใผใใๆญฃใใใใใพใใใ",nextUserAction:"PINใณใผใใ็ขบ่ชใใฆใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},incorrect_zip:{description:"The ZIP/postal code is incorrect.",nextSteps:"The customer should try again using the correct billing ZIP/postal code.",nextUserAction:"Please try again using the correct ZIP/postal code.",category:"HARD_DECLINE",translations:{ja:{description:"้ตไพฟ็ชๅทใๆญฃใใใใใพใใใ",nextUserAction:"ๆญฃใใ้ตไพฟ็ชๅทใไฝฟ็จใใฆใใไธๅบฆใ่ฉฆใใใ ใใใ"}}},insufficient_funds:{description:"The card has insufficient funds to complete the purchase.",nextSteps:"The customer should use an alternative payment method.",nextUserAction:"Please try again using an alternative payment method.",category:"SOFT_DECLINE",translations:{ja:{description:"ใซใผใใฎ่ณผๅ
ฅใซๅฟ
่ฆใช่ณ้ใไธ่ถณใใฆใใพใใ",nextUserAction:"ๅฅใฎใๆฏๆใๆนๆณใไฝฟ็จใใฆใใไธๅบฆใ่ฉฆใใใ ใใใ"}}},invalid_account:{description:"The card, or account the card is connected to, is invalid.",nextSteps:"The customer needs to contact their card issuer to check that the card is working correctly.",nextUserAction:"Please contact your card issuer for more information.",category:"HARD_DECLINE",translations:{ja:{description:"ใซใผใใใพใใฏใซใผใใๆฅ็ถใใใฆใใใขใซใฆใณใใ็กๅนใงใใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},invalid_amount:{description:"The payment amount is invalid, or exceeds the amount that is allowed.",nextSteps:"If the amount appears to be correct, the customer needs to check with their card issuer that they can make purchases of that amount.",nextUserAction:"Please contact your card issuer for more information.",category:"SOFT_DECLINE",translations:{ja:{description:"ๆฏๆใ้้กใ็กๅนใงใใใใ่จฑๅฏใใใฆใใ้้กใ่ถ
ใใฆใใพใใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},invalid_cvc:{description:"The CVC number is incorrect.",nextSteps:"The customer should try again using the correct CVC.",nextUserAction:"Please try again using the correct CVC.",category:"HARD_DECLINE",translations:{ja:{description:"CVC็ชๅทใๆญฃใใใใใพใใใ",nextUserAction:"ๆญฃใใCVCใไฝฟ็จใใฆใใไธๅบฆใใ็ดใใฆใใ ใใใ"}}},invalid_expiry_year:{description:"The expiration year invalid.",nextSteps:"The customer should try again using the correct expiration date.",nextUserAction:"Please try again using the correct expiration date.",category:"HARD_DECLINE",translations:{ja:{description:"ๆๅนๆ้ใ็กๅนใงใใ",nextUserAction:"ๆญฃใใๆๅนๆ้ใๅ
ฅๅใใฆใใไธๅบฆใ่ฉฆใใใ ใใใ"}}},invalid_number:{description:"The card number is incorrect.",nextSteps:"The customer should try again using the correct card number.",nextUserAction:"Please try again using the correct card number.",category:"HARD_DECLINE",translations:{ja:{description:"ใซใผใ็ชๅทใๆญฃใใใใใพใใใ",nextUserAction:"ๆญฃใใใซใผใ็ชๅทใไฝฟ็จใใฆใใไธๅบฆใใ็ดใใฆใใ ใใใ"}}},invalid_pin:{description:"The PIN entered is incorrect. This decline code only applies to payments made with a card reader.",nextSteps:"The customer should try again using the correct PIN.",nextUserAction:"Please try again using the correct card PIN.",category:"HARD_DECLINE",translations:{ja:{description:"PINใณใผใใๆญฃใใใใใพใใใ",nextUserAction:"ๆญฃใใPINใณใผใใไฝฟ็จใใฆใใไธๅบฆใใ็ดใใฆใใ ใใใ"}}},issuer_not_available:{description:"The card issuer could not be reached, so the payment could not be authorized.",nextSteps:"The payment should be attempted again. If it still cannot be processed, the customer needs to contact their card issuer.",nextUserAction:"Please try again. If it still cannot be processed, the please contact your card issuer.",category:"SOFT_DECLINE",translations:{ja:{description:"ใซใผใ็บ่ก่
ใซ้ฃ็ตกใงใใชใใฃใใใใๆฏๆใใๆฟ่ชใงใใพใใใงใใใ",nextUserAction:"ใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},lost_card:{description:"The payment has been declined because the card is reported lost.",nextSteps:"The specific reason for the decline should not be reported to the customer. Instead, it needs to be presented as a generic decline.",nextUserAction:"Please contact your card issuer for more information.",category:"HARD_DECLINE",translations:{ja:{description:"ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},merchant_blacklist:{description:"The payment has been declined because it matches a value on the Stripe user's blocklist.",nextSteps:"Do not report more detailed information to your customer. Instead, present as you would the generic_decline described above.",nextUserAction:"Please contact your card issuer for more information.",category:"HARD_DECLINE",translations:{ja:{description:"ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},new_account_information_available:{description:"The card, or account the card is connected to, is invalid.",nextSteps:"The customer needs to contact their card issuer for more information.",nextUserAction:"Please contact your card issuer for more information.",category:"SOFT_DECLINE",translations:{ja:{description:"ใซใผใใใพใใฏใซใผใใๆฅ็ถใใใฆใใใขใซใฆใณใใ็กๅนใงใใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},no_action_taken:{description:"The card has been declined for an unknown reason.",nextSteps:"The customer should contact their card issuer for more information.",nextUserAction:"Please contact your card issuer for more information.",category:"SOFT_DECLINE",translations:{ja:{description:"ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},not_permitted:{description:"The payment is not permitted.",nextSteps:"The customer needs to contact their card issuer for more information.",nextUserAction:"Please contact your card issuer for more information.",category:"HARD_DECLINE",translations:{ja:{description:"ๆฏๆใใฏ่จฑๅฏใใใฆใใพใใใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},pickup_card:{description:"The card cannot be used to make this payment (it is possible it has been reported lost or stolen).",nextSteps:"The customer needs to contact their card issuer for more information.",nextUserAction:"Please contact your card issuer for more information.",category:"HARD_DECLINE",translations:{ja:{description:"ใซใผใใงใใฎๆฏๆใใ่กใใใจใฏใงใใพใใ๏ผ็ดๅคฑใพใใฏ็้ฃใซใใฃใใจๅ ฑๅใใใฆใใๅฏ่ฝๆงใใใใพใ๏ผใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},pin_try_exceeded:{description:"The allowable number of PIN tries has been exceeded.",nextSteps:"The customer must use another card or method of payment.",nextUserAction:"Please use another card or method of payment.",category:"SOFT_DECLINE",translations:{ja:{description:"PIN่ฉฆ่กๅๆฐใฎไธ้ใ่ถ
ใใพใใใ",nextUserAction:"ๅฅใฎใซใผใใพใใฏใๆฏๆใๆนๆณใใๅฉ็จใใ ใใใ"}}},processing_error:{description:"An error occurred while processing the card.",nextSteps:"The payment should be attempted again. If it still cannot be processed, try again later.",nextUserAction:"Please try again. If it still cannot be processed, the please contact your card issuer.",category:"SOFT_DECLINE",translations:{ja:{description:"ใซใผใใฎๅฆ็ไธญใซใจใฉใผใ็บ็ใใพใใใ",nextUserAction:"ใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},reenter_transaction:{description:"The payment could not be processed by the issuer for an unknown reason.",nextSteps:"The payment should be attempted again. If it still cannot be processed, the customer needs to contact their card issuer.",nextUserAction:"Please try again. If it still cannot be processed, the please contact your card issuer.",category:"SOFT_DECLINE",translations:{ja:{description:"ๅๅ ไธๆใฎใใใ็บ่ก่
ใๆฏๆใใๅฆ็ใงใใพใใใงใใใ",nextUserAction:"ใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},restricted_card:{description:"The card cannot be used to make this payment (it is possible it has been reported lost or stolen).",nextSteps:"The customer needs to contact their card issuer for more information.",nextUserAction:"Please contact your card issuer for more information.",category:"HARD_DECLINE",translations:{ja:{description:"ใซใผใใงใใฎๆฏๆใใ่กใใใจใฏใงใใพใใ๏ผ็ดๅคฑใพใใฏ็้ฃใซใใฃใใจๅ ฑๅใใใฆใใๅฏ่ฝๆงใใใใพใ๏ผใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},revocation_of_all_authorizations:{description:"The card has been declined for an unknown reason.",nextSteps:"The customer should contact their card issuer for more information.",nextUserAction:"Please contact your card issuer for more information.",category:"HARD_DECLINE",translations:{ja:{description:"ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},revocation_of_authorization:{description:"The card has been declined for an unknown reason.",nextSteps:"The customer should contact their card issuer for more information.",nextUserAction:"Please contact your card issuer for more information.",category:"HARD_DECLINE",translations:{ja:{description:"ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},security_violation:{description:"The card has been declined for an unknown reason.",nextSteps:"The customer needs to contact their card issuer for more information.",nextUserAction:"Please contact your card issuer for more information.",category:"HARD_DECLINE",translations:{ja:{description:"ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},service_not_allowed:{description:"The card has been declined for an unknown reason.",nextSteps:"The customer should contact their card issuer for more information.",nextUserAction:"Please contact your card issuer for more information.",category:"HARD_DECLINE",translations:{ja:{description:"ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},stolen_card:{description:"The payment has been declined because the card is reported stolen.",nextSteps:"The specific reason for the decline should not be reported to the customer. Instead, it needs to be presented as a generic decline.",nextUserAction:"Please contact your card issuer for more information.",category:"HARD_DECLINE",translations:{ja:{description:"ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},stop_payment_order:{description:"The card has been declined for an unknown reason.",nextSteps:"The customer should contact their card issuer for more information.",nextUserAction:"Please contact your card issuer for more information.",category:"HARD_DECLINE",translations:{ja:{description:"ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},testmode_decline:{description:"A Stripe test card number was used.",nextSteps:"A genuine card must be used to make a payment.",nextUserAction:"A genuine card must be used to make a payment.",category:"HARD_DECLINE",translations:{ja:{description:"Stripeใในใใซใผใ็ชๅทใไฝฟ็จใใพใใใ",nextUserAction:"ๆฏๆใใซใฏๆฌ็ฉใฎใซใผใใไฝฟ็จใใๅฟ
่ฆใใใใพใใ"}}},transaction_not_allowed:{description:"The card has been declined for an unknown reason.",nextSteps:"The customer needs to contact their card issuer for more information.",nextUserAction:"Please contact your card issuer for more information.",category:"HARD_DECLINE",translations:{ja:{description:"ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ",nextUserAction:"่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},try_again_later:{description:"The card has been declined for an unknown reason.",nextSteps:"Ask the customer to attempt the payment again. If subsequent payments are declined, the customer should contact their card issuer for more information.",nextUserAction:"Please try again. If it still cannot be processed, the please contact your card issuer.",category:"SOFT_DECLINE",translations:{ja:{description:"ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ",nextUserAction:"ใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}},withdrawal_count_limit_exceeded:{description:"The customer has exceeded the balance or credit limit available on their card.",nextSteps:"The customer should use an alternative payment method.",nextUserAction:"Please use another card or contact your card issuer for more information.",category:"SOFT_DECLINE",translations:{ja:{description:"ใใฎใซใผใใฎๆฎ้ซใพใใฏใฏใฌใธใใๅถ้ใ่ถ
ใใพใใใ",nextUserAction:"ๅฅใฎใซใผใใไฝฟ็จใใใใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ"}}}};function y(e){if(!e||!o(e))return{docVersion:s,code:{}};const t=r[e];return{docVersion:s,code:t}}function c(e,t="en"){if(!o(e))return;const n=r[e];return t==="en"?n.nextUserAction:n.translations?.[t]?.nextUserAction}function f(){return Object.keys(r)}function o(e){return Object.hasOwn(r,e)}function x(){return s}function g(e,t="en",n){const i=c(e,t);if(!i)return;if(!n||Object.keys(n).length===0)return i;let a=i;for(const[l,p]of Object.entries(n)){const h=l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),m=new RegExp(`\\{\\{${h}\\}\\}`,"g");a=a.replace(m,p)}return a}function d(e){if(o(e))return r[e].category}function A(e){return d(e)==="HARD_DECLINE"}function _(e){return d(e)==="SOFT_DECLINE"}function D(e,t="en"){if(u(e))return c(e.decline_code,t)}function u(e){return typeof e=="object"&&e!==null&&"decline_code"in e&&typeof e.decline_code=="string"&&o(e.decline_code)}function E(e){return u(e)?e.decline_code:void 0}exports.DECLINE_CODES=r;exports.DOC_VERSION=s;exports.formatDeclineMessage=g;exports.getAllDeclineCodes=f;exports.getDeclineCategory=d;exports.getDeclineCodeFromError=E;exports.getDeclineDescription=y;exports.getDeclineMessage=c;exports.getDocVersion=x;exports.getMessageFromStripeError=D;exports.isHardDecline=A;exports.isSoftDecline=_;exports.isStripeDeclineError=u;exports.isValidDeclineCode=o;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/data/decline-codes.ts","../src/index.ts"],"sourcesContent":["import type { DeclineCode, DeclineCodeInfo } from '../types.js';\n\n/**\n * Stripe API documentation version for decline codes\n * Last updated: 2024-12\n * Reference: https://docs.stripe.com/declines/codes\n */\nexport const DOC_VERSION = '2024-12-18';\n\n/**\n * Complete database of Stripe decline codes with descriptions and recommended actions\n * Includes English and Japanese translations\n */\nexport const DECLINE_CODES: Record<DeclineCode, DeclineCodeInfo> = {\n approve_with_id: {\n description: 'The payment cannot be authorized.',\n nextSteps:\n 'The payment should be attempted again. If it still cannot be processed, the customer needs to contact their card issuer.',\n nextUserAction:\n 'Please try again. If it still cannot be processed, the please contact your card issuer.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ๆฏๆใใฏๆฟ่ชใงใใพใใใ',\n nextUserAction:\n 'ใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n call_issuer: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer needs to contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n card_not_supported: {\n description: 'The card does not support this type of purchase.',\n nextSteps:\n 'The customer needs to contact their card issuer to make sure their card can be used to make this type of purchase.',\n nextUserAction:\n 'Your card issuer may not support this type of purchase, please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏใใฎใฟใคใใฎ่ณผๅ
ฅใใตใใผใใใพใใใ',\n nextUserAction:\n 'ใซใผใ็บ่ก่
ใฏใใฎใฟใคใใฎ่ณผๅ
ฅใใตใใผใใใฆใใชใๅฏ่ฝๆงใใใใพใใ่ฉณ็ดฐใซใคใใฆใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n card_velocity_exceeded: {\n description: 'The customer has exceeded the balance or credit limit available on their card.',\n nextSteps: 'The customer should contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใใฎใซใผใใฎๆฎ้ซใพใใฏใฏใฌใธใใๅถ้ใ่ถ
ใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n currency_not_supported: {\n description: 'The card does not support the specified currency.',\n nextSteps:\n 'The customer needs to check with the issuer whether the card can be used for the type of currency specified.',\n nextUserAction:\n 'Please contact your card issuer to verify this type of currency can be used for this payment.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆๅฎใใใ้่ฒจใใตใใผใใใฆใใพใใใ',\n nextUserAction:\n 'ใใฎๆฏๆใใซใใฎใฟใคใใฎ้่ฒจใไฝฟ็จใงใใใใจใ็ขบ่ชใใใซใฏใใซใผใ็บ่กไผ็คพใซ้ฃ็ตกใใฆใใ ใใใ',\n },\n },\n },\n do_not_honor: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer needs to contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n do_not_try_again: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer should contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n duplicate_transaction: {\n description:\n 'A transaction with identical amount and credit card information was submitted very recently.',\n nextSteps: 'Check to see if a recent payment already exists.',\n nextUserAction: 'Check to see if a recent payment already exists.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใใๆ่ฟใๅไธใฎ้้กใจใฏใฌใธใใใซใผใๆ
ๅ ฑใไฝฟ็จใใๅๅผใ้ไฟกใใใพใใใ',\n nextUserAction: 'ๆ่ฟใฎๆฏๆใใๆขใซๅญๅจใใใใฉใใใ็ขบ่ชใใฆใใ ใใใ',\n },\n },\n },\n expired_card: {\n description: 'The card has expired.',\n nextSteps: 'The customer should use another card.',\n nextUserAction: 'Please use another card.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆ้ๅใใงใใ',\n nextUserAction: 'ๅฅใฎใซใผใใไฝฟ็จใใฆใใ ใใใ',\n },\n },\n },\n fraudulent: {\n description: 'The payment has been declined as Stripe suspects it is fraudulent.',\n nextSteps:\n 'Do not report more detailed information to your customer. Instead, present as you would the generic_decline described below.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ไธๆญฃใจๆใใใใใใๆฏๆใใฏๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n generic_decline: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer needs to contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n incorrect_number: {\n description: 'The card number is incorrect.',\n nextSteps: 'The customer should try again using the correct card number.',\n nextUserAction:\n 'Please check your card numbers and try again. If it still cannot be processed, the please contact your card issuer.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใ็ชๅทใๆญฃใใใใใพใใใ',\n nextUserAction:\n 'ใซใผใ็ชๅทใ็ขบ่ชใใฆใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n incorrect_cvc: {\n description: 'The CVC number is incorrect.',\n nextSteps: 'The customer should try again using the correct CVC.',\n nextUserAction:\n 'Please check your card numbers and try again. If it still cannot be processed, the please contact your card issuer.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'CVC็ชๅทใๆญฃใใใใใพใใใ',\n nextUserAction:\n 'CSC็ชๅทใ็ขบ่ชใใฆใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n incorrect_pin: {\n description:\n 'The PIN entered is incorrect. This decline code only applies to payments made with a card reader.',\n nextSteps: 'The customer should try again using the correct PIN.',\n nextUserAction:\n 'Please check your PIN and try again. If it still cannot be processed, the please contact your card issuer.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'PINใณใผใใๆญฃใใใใใพใใใ',\n nextUserAction:\n 'PINใณใผใใ็ขบ่ชใใฆใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n incorrect_zip: {\n description: 'The ZIP/postal code is incorrect.',\n nextSteps: 'The customer should try again using the correct billing ZIP/postal code.',\n nextUserAction: 'Please try again using the correct ZIP/postal code.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: '้ตไพฟ็ชๅทใๆญฃใใใใใพใใใ',\n nextUserAction: 'ๆญฃใใ้ตไพฟ็ชๅทใไฝฟ็จใใฆใใไธๅบฆใ่ฉฆใใใ ใใใ',\n },\n },\n },\n insufficient_funds: {\n description: 'The card has insufficient funds to complete the purchase.',\n nextSteps: 'The customer should use an alternative payment method.',\n nextUserAction: 'Please try again using an alternative payment method.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฎ่ณผๅ
ฅใซๅฟ
่ฆใช่ณ้ใไธ่ถณใใฆใใพใใ',\n nextUserAction: 'ๅฅใฎใๆฏๆใๆนๆณใไฝฟ็จใใฆใใไธๅบฆใ่ฉฆใใใ ใใใ',\n },\n },\n },\n invalid_account: {\n description: 'The card, or account the card is connected to, is invalid.',\n nextSteps:\n 'The customer needs to contact their card issuer to check that the card is working correctly.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใใพใใฏใซใผใใๆฅ็ถใใใฆใใใขใซใฆใณใใ็กๅนใงใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n invalid_amount: {\n description: 'The payment amount is invalid, or exceeds the amount that is allowed.',\n nextSteps:\n 'If the amount appears to be correct, the customer needs to check with their card issuer that they can make purchases of that amount.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ๆฏๆใ้้กใ็กๅนใงใใใใ่จฑๅฏใใใฆใใ้้กใ่ถ
ใใฆใใพใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n invalid_cvc: {\n description: 'The CVC number is incorrect.',\n nextSteps: 'The customer should try again using the correct CVC.',\n nextUserAction: 'Please try again using the correct CVC.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'CVC็ชๅทใๆญฃใใใใใพใใใ',\n nextUserAction: 'ๆญฃใใCVCใไฝฟ็จใใฆใใไธๅบฆใใ็ดใใฆใใ ใใใ',\n },\n },\n },\n invalid_expiry_year: {\n description: 'The expiration year invalid.',\n nextSteps: 'The customer should try again using the correct expiration date.',\n nextUserAction: 'Please try again using the correct expiration date.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ๆๅนๆ้ใ็กๅนใงใใ',\n nextUserAction: 'ๆญฃใใๆๅนๆ้ใๅ
ฅๅใใฆใใไธๅบฆใ่ฉฆใใใ ใใใ',\n },\n },\n },\n invalid_number: {\n description: 'The card number is incorrect.',\n nextSteps: 'The customer should try again using the correct card number.',\n nextUserAction: 'Please try again using the correct card number.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใ็ชๅทใๆญฃใใใใใพใใใ',\n nextUserAction: 'ๆญฃใใใซใผใ็ชๅทใไฝฟ็จใใฆใใไธๅบฆใใ็ดใใฆใใ ใใใ',\n },\n },\n },\n invalid_pin: {\n description:\n 'The PIN entered is incorrect. This decline code only applies to payments made with a card reader.',\n nextSteps: 'The customer should try again using the correct PIN.',\n nextUserAction: 'Please try again using the correct card PIN.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'PINใณใผใใๆญฃใใใใใพใใใ',\n nextUserAction: 'ๆญฃใใPINใณใผใใไฝฟ็จใใฆใใไธๅบฆใใ็ดใใฆใใ ใใใ',\n },\n },\n },\n issuer_not_available: {\n description: 'The card issuer could not be reached, so the payment could not be authorized.',\n nextSteps:\n 'The payment should be attempted again. If it still cannot be processed, the customer needs to contact their card issuer.',\n nextUserAction:\n 'Please try again. If it still cannot be processed, the please contact your card issuer.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใ็บ่ก่
ใซ้ฃ็ตกใงใใชใใฃใใใใๆฏๆใใๆฟ่ชใงใใพใใใงใใใ',\n nextUserAction:\n 'ใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n lost_card: {\n description: 'The payment has been declined because the card is reported lost.',\n nextSteps:\n 'The specific reason for the decline should not be reported to the customer. Instead, it needs to be presented as a generic decline.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n merchant_blacklist: {\n description:\n \"The payment has been declined because it matches a value on the Stripe user's blocklist.\",\n nextSteps:\n 'Do not report more detailed information to your customer. Instead, present as you would the generic_decline described above.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n new_account_information_available: {\n description: 'The card, or account the card is connected to, is invalid.',\n nextSteps: 'The customer needs to contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใใพใใฏใซใผใใๆฅ็ถใใใฆใใใขใซใฆใณใใ็กๅนใงใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n no_action_taken: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer should contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n not_permitted: {\n description: 'The payment is not permitted.',\n nextSteps: 'The customer needs to contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ๆฏๆใใฏ่จฑๅฏใใใฆใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n pickup_card: {\n description:\n 'The card cannot be used to make this payment (it is possible it has been reported lost or stolen).',\n nextSteps: 'The customer needs to contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description:\n 'ใซใผใใงใใฎๆฏๆใใ่กใใใจใฏใงใใพใใ๏ผ็ดๅคฑใพใใฏ็้ฃใซใใฃใใจๅ ฑๅใใใฆใใๅฏ่ฝๆงใใใใพใ๏ผใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n pin_try_exceeded: {\n description: 'The allowable number of PIN tries has been exceeded.',\n nextSteps: 'The customer must use another card or method of payment.',\n nextUserAction: 'Please use another card or method of payment.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'PIN่ฉฆ่กๅๆฐใฎไธ้ใ่ถ
ใใพใใใ',\n nextUserAction: 'ๅฅใฎใซใผใใพใใฏใๆฏๆใๆนๆณใใๅฉ็จใใ ใใใ',\n },\n },\n },\n processing_error: {\n description: 'An error occurred while processing the card.',\n nextSteps:\n 'The payment should be attempted again. If it still cannot be processed, try again later.',\n nextUserAction:\n 'Please try again. If it still cannot be processed, the please contact your card issuer.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฎๅฆ็ไธญใซใจใฉใผใ็บ็ใใพใใใ',\n nextUserAction:\n 'ใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n reenter_transaction: {\n description: 'The payment could not be processed by the issuer for an unknown reason.',\n nextSteps:\n 'The payment should be attempted again. If it still cannot be processed, the customer needs to contact their card issuer.',\n nextUserAction:\n 'Please try again. If it still cannot be processed, the please contact your card issuer.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ๅๅ ไธๆใฎใใใ็บ่ก่
ใๆฏๆใใๅฆ็ใงใใพใใใงใใใ',\n nextUserAction:\n 'ใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n restricted_card: {\n description:\n 'The card cannot be used to make this payment (it is possible it has been reported lost or stolen).',\n nextSteps: 'The customer needs to contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description:\n 'ใซใผใใงใใฎๆฏๆใใ่กใใใจใฏใงใใพใใ๏ผ็ดๅคฑใพใใฏ็้ฃใซใใฃใใจๅ ฑๅใใใฆใใๅฏ่ฝๆงใใใใพใ๏ผใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n revocation_of_all_authorizations: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer should contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n revocation_of_authorization: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer should contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n security_violation: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer needs to contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n service_not_allowed: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer should contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n stolen_card: {\n description: 'The payment has been declined because the card is reported stolen.',\n nextSteps:\n 'The specific reason for the decline should not be reported to the customer. Instead, it needs to be presented as a generic decline.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n stop_payment_order: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer should contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n testmode_decline: {\n description: 'A Stripe test card number was used.',\n nextSteps: 'A genuine card must be used to make a payment.',\n nextUserAction: 'A genuine card must be used to make a payment.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'Stripeใในใใซใผใ็ชๅทใไฝฟ็จใใพใใใ',\n nextUserAction: 'ๆฏๆใใซใฏๆฌ็ฉใฎใซใผใใไฝฟ็จใใๅฟ
่ฆใใใใพใใ',\n },\n },\n },\n transaction_not_allowed: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer needs to contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n try_again_later: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps:\n 'Ask the customer to attempt the payment again. If subsequent payments are declined, the customer should contact their card issuer for more information.',\n nextUserAction:\n 'Please try again. If it still cannot be processed, the please contact your card issuer.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction:\n 'ใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n withdrawal_count_limit_exceeded: {\n description: 'The customer has exceeded the balance or credit limit available on their card.',\n nextSteps: 'The customer should use an alternative payment method.',\n nextUserAction: 'Please use another card or contact your card issuer for more information.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใใฎใซใผใใฎๆฎ้ซใพใใฏใฏใฌใธใใๅถ้ใ่ถ
ใใพใใใ',\n nextUserAction: 'ๅฅใฎใซใผใใไฝฟ็จใใใใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n};\n","import { DECLINE_CODES, DOC_VERSION } from './data/decline-codes.js';\nimport type {\n DeclineCategory,\n DeclineCode,\n DeclineCodeResult,\n Locale,\n StripeError,\n} from './types.js';\n\n/**\n * Get decline code information with description and recommended actions\n *\n * @param declineCode - The Stripe decline code to look up\n * @returns Object containing the decline code information and documentation version\n *\n * @example\n * ```ts\n * const result = getDeclineDescription('insufficient_funds');\n * console.log(result.code.description);\n * // => \"The card has insufficient funds to complete the purchase.\"\n * console.log(result.code.nextUserAction);\n * // => \"Please try again using an alternative payment method.\"\n * ```\n */\nexport function getDeclineDescription(declineCode?: string): DeclineCodeResult {\n if (!declineCode || !isValidDeclineCode(declineCode)) {\n return {\n docVersion: DOC_VERSION,\n code: {},\n };\n }\n\n const code = DECLINE_CODES[declineCode];\n return {\n docVersion: DOC_VERSION,\n code,\n };\n}\n\n/**\n * Get localized decline code message for end users\n *\n * @param declineCode - The Stripe decline code\n * @param locale - The locale to use (default: 'en')\n * @returns User-facing message in the specified locale, or undefined if not found\n *\n * @example\n * ```ts\n * const message = getDeclineMessage('insufficient_funds', 'ja');\n * console.log(message);\n * // => \"ๅฅใฎใๆฏๆใๆนๆณใไฝฟ็จใใฆใใไธๅบฆใ่ฉฆใใใ ใใใ\"\n * ```\n */\nexport function getDeclineMessage(declineCode: string, locale: Locale = 'en'): string | undefined {\n if (!isValidDeclineCode(declineCode)) {\n return undefined;\n }\n\n const codeInfo = DECLINE_CODES[declineCode];\n\n if (locale === 'en') {\n return codeInfo.nextUserAction;\n }\n\n return codeInfo.translations?.[locale]?.nextUserAction;\n}\n\n/**\n * Get all available decline codes\n *\n * @returns Array of all supported decline code strings\n *\n * @example\n * ```ts\n * const codes = getAllDeclineCodes();\n * console.log(codes.length); // => 44\n * console.log(codes.includes('insufficient_funds')); // => true\n * ```\n */\nexport function getAllDeclineCodes(): DeclineCode[] {\n return Object.keys(DECLINE_CODES) as DeclineCode[];\n}\n\n/**\n * Check if a decline code is valid\n *\n * @param code - The code to validate\n * @returns True if the code exists in the database\n *\n * @example\n * ```ts\n * isValidDeclineCode('insufficient_funds'); // => true\n * isValidDeclineCode('invalid_code'); // => false\n * ```\n */\nexport function isValidDeclineCode(code: string): code is DeclineCode {\n return Object.hasOwn(DECLINE_CODES, code);\n}\n\n/**\n * Get the documentation version for the decline codes data\n *\n * @returns The Stripe API documentation version string\n *\n * @example\n * ```ts\n * const version = getDocVersion();\n * console.log(version); // => \"2024-12-18\"\n * ```\n */\nexport function getDocVersion(): string {\n return DOC_VERSION;\n}\n\n/**\n * Format a decline message with custom template variables\n *\n * @param declineCode - The Stripe decline code\n * @param locale - The locale to use (default: 'en')\n * @param variables - Optional variables to replace in the message template\n * @returns Formatted user-facing message with variables replaced\n *\n * @example\n * ```ts\n * const message = formatDeclineMessage('insufficient_funds', 'en', {\n * merchantName: 'Acme Store',\n * supportEmail: 'support@acme.com'\n * });\n * console.log(message);\n * // => \"Please try again using an alternative payment method.\"\n * ```\n */\nexport function formatDeclineMessage(\n declineCode: string,\n locale: Locale = 'en',\n variables?: Record<string, string>,\n): string | undefined {\n const baseMessage = getDeclineMessage(declineCode, locale);\n\n if (!baseMessage) {\n return undefined;\n }\n\n if (!variables || Object.keys(variables).length === 0) {\n return baseMessage;\n }\n\n // Replace variables in the format {{variableName}}\n let formattedMessage = baseMessage;\n for (const [key, value] of Object.entries(variables)) {\n // Escape special regex characters in the key\n const escapedKey = key.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n const placeholder = new RegExp(`\\\\{\\\\{${escapedKey}\\\\}\\\\}`, 'g');\n formattedMessage = formattedMessage.replace(placeholder, value);\n }\n\n return formattedMessage;\n}\n\n/**\n * Get the category of a decline code (SOFT_DECLINE or HARD_DECLINE)\n *\n * @param code - The decline code to categorize\n * @returns The category of the decline code, or undefined if invalid\n *\n * @example\n * ```ts\n * getDeclineCategory('insufficient_funds'); // => 'SOFT_DECLINE'\n * getDeclineCategory('fraudulent'); // => 'HARD_DECLINE'\n * ```\n */\nexport function getDeclineCategory(code: string): DeclineCategory | undefined {\n if (!isValidDeclineCode(code)) {\n return undefined;\n }\n\n return DECLINE_CODES[code].category;\n}\n\n/**\n * Check if a decline code is a hard decline (permanent, should not retry)\n *\n * @param code - The decline code to check\n * @returns True if the code is a hard decline\n *\n * @example\n * ```ts\n * isHardDecline('fraudulent'); // => true\n * isHardDecline('insufficient_funds'); // => false\n * ```\n */\nexport function isHardDecline(code: string): boolean {\n return getDeclineCategory(code) === 'HARD_DECLINE';\n}\n\n/**\n * Check if a decline code is a soft decline (temporary, can retry)\n *\n * @param code - The decline code to check\n * @returns True if the code is a soft decline\n *\n * @example\n * ```ts\n * isSoftDecline('insufficient_funds'); // => true\n * isSoftDecline('fraudulent'); // => false\n * ```\n */\nexport function isSoftDecline(code: string): boolean {\n return getDeclineCategory(code) === 'SOFT_DECLINE';\n}\n\n/**\n * Extract localized message from a Stripe error object\n *\n * @param error - The Stripe error object\n * @param locale - The locale to use (default: 'en')\n * @returns User-facing message in the specified locale, or undefined if not found\n *\n * @example\n * ```ts\n * const stripeError = {\n * type: 'StripeCardError',\n * decline_code: 'insufficient_funds',\n * message: 'Your card has insufficient funds.'\n * };\n * const message = getMessageFromStripeError(stripeError, 'ja');\n * console.log(message);\n * // => \"ๅฅใฎใๆฏๆใๆนๆณใไฝฟ็จใใฆใใไธๅบฆใ่ฉฆใใใ ใใใ\"\n * ```\n */\nexport function getMessageFromStripeError(\n error: StripeError,\n locale: Locale = 'en',\n): string | undefined {\n if (!error.decline_code) {\n return undefined;\n }\n\n return getDeclineMessage(error.decline_code, locale);\n}\n\n// Export data for advanced use cases\nexport { DECLINE_CODES, DOC_VERSION } from './data/decline-codes.js';\n// Export types\nexport type {\n DeclineCategory,\n DeclineCode,\n DeclineCodeInfo,\n DeclineCodeResult,\n Locale,\n StripeError,\n Translation,\n} from './types.js';\n"],"names":["DOC_VERSION","DECLINE_CODES","getDeclineDescription","declineCode","isValidDeclineCode","code","getDeclineMessage","locale","codeInfo","getAllDeclineCodes","getDocVersion","formatDeclineMessage","variables","baseMessage","formattedMessage","key","value","escapedKey","placeholder","getDeclineCategory","isHardDecline","isSoftDecline","getMessageFromStripeError","error"],"mappings":"gFAOO,MAAMA,EAAc,aAMdC,EAAsD,CACjE,gBAAiB,CACf,YAAa,oCACb,UACE,2HACF,eACE,0FACF,SAAU,eACV,aAAc,CACZ,GAAI,CACF,YAAa,eACb,eACE,iDAAA,CACJ,CACF,EAEF,YAAa,CACX,YAAa,oDACb,UAAW,wEACX,eAAgB,wDAChB,SAAU,eACV,aAAc,CACZ,GAAI,CACF,YAAa,qBACb,eAAgB,yBAAA,CAClB,CACF,EAEF,mBAAoB,CAClB,YAAa,mDACb,UACE,qHACF,eACE,gHACF,SAAU,eACV,aAAc,CACZ,GAAI,CACF,YAAa,yBACb,eACE,+DAAA,CACJ,CACF,EAEF,uBAAwB,CACtB,YAAa,iFACb,UAAW,sEACX,eAAgB,wDAChB,SAAU,eACV,aAAc,CACZ,GAAI,CACF,YAAa,4BACb,eAAgB,yBAAA,CAClB,CACF,EAEF,uBAAwB,CACtB,YAAa,oDACb,UACE,+GACF,eACE,gGACF,SAAU,eACV,aAAc,CACZ,GAAI,CACF,YAAa,0BACb,eACE,iDAAA,CACJ,CACF,EAEF,aAAc,CACZ,YAAa,oDACb,UAAW,wEACX,eAAgB,wDAChB,SAAU,eACV,aAAc,CACZ,GAAI,CACF,YAAa,qBACb,eAAgB,yBAAA,CAClB,CACF,EAEF,iBAAkB,CAChB,YAAa,oDACb,UAAW,sEACX,eAAgB,wDAChB,SAAU,eACV,aAAc,CACZ,GAAI,CACF,YAAa,qBACb,eAAgB,yBAAA,CAClB,CACF,EAEF,sBAAuB,CACrB,YACE,+FACF,UAAW,mDACX,eAAgB,mDAChB,SAAU,eACV,aAAc,CACZ,GAAI,CACF,YAAa,wCACb,eAAgB,6BAAA,CAClB,CACF,EAEF,aAAc,CACZ,YAAa,wBACb,UAAW,wCACX,eAAgB,2BAChB,SAAU,eACV,aAAc,CACZ,GAAI,CACF,YAAa,cACb,eAAgB,iBAAA,CA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,EACoB,CACpB,MAAMC,EAAcP,EAAkBH,EAAaI,CAAM,EAEzD,GAAI,CAACM,EACH,OAGF,GAAI,CAACD,GAAa,OAAO,KAAKA,CAAS,EAAE,SAAW,EAClD,OAAOC,EAIT,IAAIC,EAAmBD,EACvB,SAAW,CAACE,EAAKC,CAAK,IAAK,OAAO,QAAQJ,CAAS,EAAG,CAEpD,MAAMK,EAAaF,EAAI,QAAQ,sBAAuB,MAAM,EACtDG,EAAc,IAAI,OAAO,SAASD,CAAU,SAAU,GAAG,EAC/DH,EAAmBA,EAAiB,QAAQI,EAAaF,CAAK,CAChE,CAEA,OAAOF,CACT,CAcO,SAASK,EAAmBd,EAA2C,CAC5E,GAAKD,EAAmBC,CAAI,EAI5B,OAAOJ,EAAcI,CAAI,EAAE,QAC7B,CAcO,SAASe,EAAcf,EAAuB,CACnD,OAAOc,EAAmBd,CAAI,IAAM,cACtC,CAcO,SAASgB,EAAchB,EAAuB,CACnD,OAAOc,EAAmBd,CAAI,IAAM,cACtC,CAqBO,SAASiB,EACdC,EACAhB,EAAiB,KACG,CACpB,GAAKgB,EAAM,aAIX,OAAOjB,EAAkBiB,EAAM,aAAchB,CAAM,CACrD"}
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/data/decline-codes.ts","../src/index.ts"],"sourcesContent":["import type { DeclineCode, DeclineCodeInfo } from '../types.js';\n\n/**\n * Stripe API documentation version for decline codes\n * Last updated: 2024-12\n * Reference: https://docs.stripe.com/declines/codes\n */\nexport const DOC_VERSION = '2024-12-18';\n\n/**\n * Complete database of Stripe decline codes with descriptions and recommended actions\n * Includes English and Japanese translations\n */\nexport const DECLINE_CODES: Record<DeclineCode, DeclineCodeInfo> = {\n approve_with_id: {\n description: 'The payment cannot be authorized.',\n nextSteps:\n 'The payment should be attempted again. If it still cannot be processed, the customer needs to contact their card issuer.',\n nextUserAction:\n 'Please try again. If it still cannot be processed, the please contact your card issuer.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ๆฏๆใใฏๆฟ่ชใงใใพใใใ',\n nextUserAction:\n 'ใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n call_issuer: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer needs to contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n card_not_supported: {\n description: 'The card does not support this type of purchase.',\n nextSteps:\n 'The customer needs to contact their card issuer to make sure their card can be used to make this type of purchase.',\n nextUserAction:\n 'Your card issuer may not support this type of purchase, please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏใใฎใฟใคใใฎ่ณผๅ
ฅใใตใใผใใใพใใใ',\n nextUserAction:\n 'ใซใผใ็บ่ก่
ใฏใใฎใฟใคใใฎ่ณผๅ
ฅใใตใใผใใใฆใใชใๅฏ่ฝๆงใใใใพใใ่ฉณ็ดฐใซใคใใฆใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n card_velocity_exceeded: {\n description: 'The customer has exceeded the balance or credit limit available on their card.',\n nextSteps: 'The customer should contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใใฎใซใผใใฎๆฎ้ซใพใใฏใฏใฌใธใใๅถ้ใ่ถ
ใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n currency_not_supported: {\n description: 'The card does not support the specified currency.',\n nextSteps:\n 'The customer needs to check with the issuer whether the card can be used for the type of currency specified.',\n nextUserAction:\n 'Please contact your card issuer to verify this type of currency can be used for this payment.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆๅฎใใใ้่ฒจใใตใใผใใใฆใใพใใใ',\n nextUserAction:\n 'ใใฎๆฏๆใใซใใฎใฟใคใใฎ้่ฒจใไฝฟ็จใงใใใใจใ็ขบ่ชใใใซใฏใใซใผใ็บ่กไผ็คพใซ้ฃ็ตกใใฆใใ ใใใ',\n },\n },\n },\n do_not_honor: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer needs to contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n do_not_try_again: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer should contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n duplicate_transaction: {\n description:\n 'A transaction with identical amount and credit card information was submitted very recently.',\n nextSteps: 'Check to see if a recent payment already exists.',\n nextUserAction: 'Check to see if a recent payment already exists.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใใๆ่ฟใๅไธใฎ้้กใจใฏใฌใธใใใซใผใๆ
ๅ ฑใไฝฟ็จใใๅๅผใ้ไฟกใใใพใใใ',\n nextUserAction: 'ๆ่ฟใฎๆฏๆใใๆขใซๅญๅจใใใใฉใใใ็ขบ่ชใใฆใใ ใใใ',\n },\n },\n },\n expired_card: {\n description: 'The card has expired.',\n nextSteps: 'The customer should use another card.',\n nextUserAction: 'Please use another card.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆ้ๅใใงใใ',\n nextUserAction: 'ๅฅใฎใซใผใใไฝฟ็จใใฆใใ ใใใ',\n },\n },\n },\n fraudulent: {\n description: 'The payment has been declined as Stripe suspects it is fraudulent.',\n nextSteps:\n 'Do not report more detailed information to your customer. Instead, present as you would the generic_decline described below.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ไธๆญฃใจๆใใใใใใๆฏๆใใฏๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n generic_decline: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer needs to contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n incorrect_number: {\n description: 'The card number is incorrect.',\n nextSteps: 'The customer should try again using the correct card number.',\n nextUserAction:\n 'Please check your card numbers and try again. If it still cannot be processed, the please contact your card issuer.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใ็ชๅทใๆญฃใใใใใพใใใ',\n nextUserAction:\n 'ใซใผใ็ชๅทใ็ขบ่ชใใฆใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n incorrect_cvc: {\n description: 'The CVC number is incorrect.',\n nextSteps: 'The customer should try again using the correct CVC.',\n nextUserAction:\n 'Please check your card numbers and try again. If it still cannot be processed, the please contact your card issuer.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'CVC็ชๅทใๆญฃใใใใใพใใใ',\n nextUserAction:\n 'CSC็ชๅทใ็ขบ่ชใใฆใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n incorrect_pin: {\n description:\n 'The PIN entered is incorrect. This decline code only applies to payments made with a card reader.',\n nextSteps: 'The customer should try again using the correct PIN.',\n nextUserAction:\n 'Please check your PIN and try again. If it still cannot be processed, the please contact your card issuer.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'PINใณใผใใๆญฃใใใใใพใใใ',\n nextUserAction:\n 'PINใณใผใใ็ขบ่ชใใฆใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n incorrect_zip: {\n description: 'The ZIP/postal code is incorrect.',\n nextSteps: 'The customer should try again using the correct billing ZIP/postal code.',\n nextUserAction: 'Please try again using the correct ZIP/postal code.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: '้ตไพฟ็ชๅทใๆญฃใใใใใพใใใ',\n nextUserAction: 'ๆญฃใใ้ตไพฟ็ชๅทใไฝฟ็จใใฆใใไธๅบฆใ่ฉฆใใใ ใใใ',\n },\n },\n },\n insufficient_funds: {\n description: 'The card has insufficient funds to complete the purchase.',\n nextSteps: 'The customer should use an alternative payment method.',\n nextUserAction: 'Please try again using an alternative payment method.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฎ่ณผๅ
ฅใซๅฟ
่ฆใช่ณ้ใไธ่ถณใใฆใใพใใ',\n nextUserAction: 'ๅฅใฎใๆฏๆใๆนๆณใไฝฟ็จใใฆใใไธๅบฆใ่ฉฆใใใ ใใใ',\n },\n },\n },\n invalid_account: {\n description: 'The card, or account the card is connected to, is invalid.',\n nextSteps:\n 'The customer needs to contact their card issuer to check that the card is working correctly.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใใพใใฏใซใผใใๆฅ็ถใใใฆใใใขใซใฆใณใใ็กๅนใงใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n invalid_amount: {\n description: 'The payment amount is invalid, or exceeds the amount that is allowed.',\n nextSteps:\n 'If the amount appears to be correct, the customer needs to check with their card issuer that they can make purchases of that amount.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ๆฏๆใ้้กใ็กๅนใงใใใใ่จฑๅฏใใใฆใใ้้กใ่ถ
ใใฆใใพใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n invalid_cvc: {\n description: 'The CVC number is incorrect.',\n nextSteps: 'The customer should try again using the correct CVC.',\n nextUserAction: 'Please try again using the correct CVC.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'CVC็ชๅทใๆญฃใใใใใพใใใ',\n nextUserAction: 'ๆญฃใใCVCใไฝฟ็จใใฆใใไธๅบฆใใ็ดใใฆใใ ใใใ',\n },\n },\n },\n invalid_expiry_year: {\n description: 'The expiration year invalid.',\n nextSteps: 'The customer should try again using the correct expiration date.',\n nextUserAction: 'Please try again using the correct expiration date.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ๆๅนๆ้ใ็กๅนใงใใ',\n nextUserAction: 'ๆญฃใใๆๅนๆ้ใๅ
ฅๅใใฆใใไธๅบฆใ่ฉฆใใใ ใใใ',\n },\n },\n },\n invalid_number: {\n description: 'The card number is incorrect.',\n nextSteps: 'The customer should try again using the correct card number.',\n nextUserAction: 'Please try again using the correct card number.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใ็ชๅทใๆญฃใใใใใพใใใ',\n nextUserAction: 'ๆญฃใใใซใผใ็ชๅทใไฝฟ็จใใฆใใไธๅบฆใใ็ดใใฆใใ ใใใ',\n },\n },\n },\n invalid_pin: {\n description:\n 'The PIN entered is incorrect. This decline code only applies to payments made with a card reader.',\n nextSteps: 'The customer should try again using the correct PIN.',\n nextUserAction: 'Please try again using the correct card PIN.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'PINใณใผใใๆญฃใใใใใพใใใ',\n nextUserAction: 'ๆญฃใใPINใณใผใใไฝฟ็จใใฆใใไธๅบฆใใ็ดใใฆใใ ใใใ',\n },\n },\n },\n issuer_not_available: {\n description: 'The card issuer could not be reached, so the payment could not be authorized.',\n nextSteps:\n 'The payment should be attempted again. If it still cannot be processed, the customer needs to contact their card issuer.',\n nextUserAction:\n 'Please try again. If it still cannot be processed, the please contact your card issuer.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใ็บ่ก่
ใซ้ฃ็ตกใงใใชใใฃใใใใๆฏๆใใๆฟ่ชใงใใพใใใงใใใ',\n nextUserAction:\n 'ใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n lost_card: {\n description: 'The payment has been declined because the card is reported lost.',\n nextSteps:\n 'The specific reason for the decline should not be reported to the customer. Instead, it needs to be presented as a generic decline.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n merchant_blacklist: {\n description:\n \"The payment has been declined because it matches a value on the Stripe user's blocklist.\",\n nextSteps:\n 'Do not report more detailed information to your customer. Instead, present as you would the generic_decline described above.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n new_account_information_available: {\n description: 'The card, or account the card is connected to, is invalid.',\n nextSteps: 'The customer needs to contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใใพใใฏใซใผใใๆฅ็ถใใใฆใใใขใซใฆใณใใ็กๅนใงใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n no_action_taken: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer should contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n not_permitted: {\n description: 'The payment is not permitted.',\n nextSteps: 'The customer needs to contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ๆฏๆใใฏ่จฑๅฏใใใฆใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n pickup_card: {\n description:\n 'The card cannot be used to make this payment (it is possible it has been reported lost or stolen).',\n nextSteps: 'The customer needs to contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description:\n 'ใซใผใใงใใฎๆฏๆใใ่กใใใจใฏใงใใพใใ๏ผ็ดๅคฑใพใใฏ็้ฃใซใใฃใใจๅ ฑๅใใใฆใใๅฏ่ฝๆงใใใใพใ๏ผใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n pin_try_exceeded: {\n description: 'The allowable number of PIN tries has been exceeded.',\n nextSteps: 'The customer must use another card or method of payment.',\n nextUserAction: 'Please use another card or method of payment.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'PIN่ฉฆ่กๅๆฐใฎไธ้ใ่ถ
ใใพใใใ',\n nextUserAction: 'ๅฅใฎใซใผใใพใใฏใๆฏๆใๆนๆณใใๅฉ็จใใ ใใใ',\n },\n },\n },\n processing_error: {\n description: 'An error occurred while processing the card.',\n nextSteps:\n 'The payment should be attempted again. If it still cannot be processed, try again later.',\n nextUserAction:\n 'Please try again. If it still cannot be processed, the please contact your card issuer.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฎๅฆ็ไธญใซใจใฉใผใ็บ็ใใพใใใ',\n nextUserAction:\n 'ใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n reenter_transaction: {\n description: 'The payment could not be processed by the issuer for an unknown reason.',\n nextSteps:\n 'The payment should be attempted again. If it still cannot be processed, the customer needs to contact their card issuer.',\n nextUserAction:\n 'Please try again. If it still cannot be processed, the please contact your card issuer.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ๅๅ ไธๆใฎใใใ็บ่ก่
ใๆฏๆใใๅฆ็ใงใใพใใใงใใใ',\n nextUserAction:\n 'ใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n restricted_card: {\n description:\n 'The card cannot be used to make this payment (it is possible it has been reported lost or stolen).',\n nextSteps: 'The customer needs to contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description:\n 'ใซใผใใงใใฎๆฏๆใใ่กใใใจใฏใงใใพใใ๏ผ็ดๅคฑใพใใฏ็้ฃใซใใฃใใจๅ ฑๅใใใฆใใๅฏ่ฝๆงใใใใพใ๏ผใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n revocation_of_all_authorizations: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer should contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n revocation_of_authorization: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer should contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n security_violation: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer needs to contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n service_not_allowed: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer should contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n stolen_card: {\n description: 'The payment has been declined because the card is reported stolen.',\n nextSteps:\n 'The specific reason for the decline should not be reported to the customer. Instead, it needs to be presented as a generic decline.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n stop_payment_order: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer should contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n testmode_decline: {\n description: 'A Stripe test card number was used.',\n nextSteps: 'A genuine card must be used to make a payment.',\n nextUserAction: 'A genuine card must be used to make a payment.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'Stripeใในใใซใผใ็ชๅทใไฝฟ็จใใพใใใ',\n nextUserAction: 'ๆฏๆใใซใฏๆฌ็ฉใฎใซใผใใไฝฟ็จใใๅฟ
่ฆใใใใพใใ',\n },\n },\n },\n transaction_not_allowed: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer needs to contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n try_again_later: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps:\n 'Ask the customer to attempt the payment again. If subsequent payments are declined, the customer should contact their card issuer for more information.',\n nextUserAction:\n 'Please try again. If it still cannot be processed, the please contact your card issuer.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction:\n 'ใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n withdrawal_count_limit_exceeded: {\n description: 'The customer has exceeded the balance or credit limit available on their card.',\n nextSteps: 'The customer should use an alternative payment method.',\n nextUserAction: 'Please use another card or contact your card issuer for more information.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใใฎใซใผใใฎๆฎ้ซใพใใฏใฏใฌใธใใๅถ้ใ่ถ
ใใพใใใ',\n nextUserAction: 'ๅฅใฎใซใผใใไฝฟ็จใใใใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n};\n","import { DECLINE_CODES, DOC_VERSION } from './data/decline-codes.js';\nimport type {\n DeclineCategory,\n DeclineCode,\n DeclineCodeResult,\n Locale,\n StripeDeclineError,\n StripeError,\n} from './types.js';\n\n/**\n * Get decline code information with description and recommended actions\n *\n * @param declineCode - The Stripe decline code to look up\n * @returns Object containing the decline code information and documentation version\n *\n * @example\n * ```ts\n * const result = getDeclineDescription('insufficient_funds');\n * console.log(result.code.description);\n * // => \"The card has insufficient funds to complete the purchase.\"\n * console.log(result.code.nextUserAction);\n * // => \"Please try again using an alternative payment method.\"\n * ```\n */\nexport function getDeclineDescription(declineCode?: string): DeclineCodeResult {\n if (!declineCode || !isValidDeclineCode(declineCode)) {\n return {\n docVersion: DOC_VERSION,\n code: {},\n };\n }\n\n const code = DECLINE_CODES[declineCode];\n return {\n docVersion: DOC_VERSION,\n code,\n };\n}\n\n/**\n * Get localized decline code message for end users\n *\n * @param declineCode - The Stripe decline code\n * @param locale - The locale to use (default: 'en')\n * @returns User-facing message in the specified locale, or undefined if not found\n *\n * @example\n * ```ts\n * const message = getDeclineMessage('insufficient_funds', 'ja');\n * console.log(message);\n * // => \"ๅฅใฎใๆฏๆใๆนๆณใไฝฟ็จใใฆใใไธๅบฆใ่ฉฆใใใ ใใใ\"\n * ```\n */\nexport function getDeclineMessage(declineCode: string, locale: Locale = 'en'): string | undefined {\n if (!isValidDeclineCode(declineCode)) {\n return undefined;\n }\n\n const codeInfo = DECLINE_CODES[declineCode];\n\n if (locale === 'en') {\n return codeInfo.nextUserAction;\n }\n\n return codeInfo.translations?.[locale]?.nextUserAction;\n}\n\n/**\n * Get all available decline codes\n *\n * @returns Array of all supported decline code strings\n *\n * @example\n * ```ts\n * const codes = getAllDeclineCodes();\n * console.log(codes.length); // => 44\n * console.log(codes.includes('insufficient_funds')); // => true\n * ```\n */\nexport function getAllDeclineCodes(): DeclineCode[] {\n return Object.keys(DECLINE_CODES) as DeclineCode[];\n}\n\n/**\n * Check if a decline code is valid\n *\n * @param code - The code to validate\n * @returns True if the code exists in the database\n *\n * @example\n * ```ts\n * isValidDeclineCode('insufficient_funds'); // => true\n * isValidDeclineCode('invalid_code'); // => false\n * ```\n */\nexport function isValidDeclineCode(code: string): code is DeclineCode {\n return Object.hasOwn(DECLINE_CODES, code);\n}\n\n/**\n * Get the documentation version for the decline codes data\n *\n * @returns The Stripe API documentation version string\n *\n * @example\n * ```ts\n * const version = getDocVersion();\n * console.log(version); // => \"2024-12-18\"\n * ```\n */\nexport function getDocVersion(): string {\n return DOC_VERSION;\n}\n\n/**\n * Format a decline message with custom template variables\n *\n * @param declineCode - The Stripe decline code\n * @param locale - The locale to use (default: 'en')\n * @param variables - Optional variables to replace in the message template\n * @returns Formatted user-facing message with variables replaced\n *\n * @example\n * ```ts\n * const message = formatDeclineMessage('insufficient_funds', 'en', {\n * merchantName: 'Acme Store',\n * supportEmail: 'support@acme.com'\n * });\n * console.log(message);\n * // => \"Please try again using an alternative payment method.\"\n * ```\n */\nexport function formatDeclineMessage(\n declineCode: string,\n locale: Locale = 'en',\n variables?: Record<string, string>,\n): string | undefined {\n const baseMessage = getDeclineMessage(declineCode, locale);\n\n if (!baseMessage) {\n return undefined;\n }\n\n if (!variables || Object.keys(variables).length === 0) {\n return baseMessage;\n }\n\n // Replace variables in the format {{variableName}}\n let formattedMessage = baseMessage;\n for (const [key, value] of Object.entries(variables)) {\n // Escape special regex characters in the key\n const escapedKey = key.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n const placeholder = new RegExp(`\\\\{\\\\{${escapedKey}\\\\}\\\\}`, 'g');\n formattedMessage = formattedMessage.replace(placeholder, value);\n }\n\n return formattedMessage;\n}\n\n/**\n * Get the category of a decline code (SOFT_DECLINE or HARD_DECLINE)\n *\n * @param code - The decline code to categorize\n * @returns The category of the decline code, or undefined if invalid\n *\n * @example\n * ```ts\n * getDeclineCategory('insufficient_funds'); // => 'SOFT_DECLINE'\n * getDeclineCategory('fraudulent'); // => 'HARD_DECLINE'\n * ```\n */\nexport function getDeclineCategory(code: string): DeclineCategory | undefined {\n if (!isValidDeclineCode(code)) {\n return undefined;\n }\n\n return DECLINE_CODES[code].category;\n}\n\n/**\n * Check if a decline code is a hard decline (permanent, should not retry)\n *\n * @param code - The decline code to check\n * @returns True if the code is a hard decline\n *\n * @example\n * ```ts\n * isHardDecline('fraudulent'); // => true\n * isHardDecline('insufficient_funds'); // => false\n * ```\n */\nexport function isHardDecline(code: string): boolean {\n return getDeclineCategory(code) === 'HARD_DECLINE';\n}\n\n/**\n * Check if a decline code is a soft decline (temporary, can retry)\n *\n * @param code - The decline code to check\n * @returns True if the code is a soft decline\n *\n * @example\n * ```ts\n * isSoftDecline('insufficient_funds'); // => true\n * isSoftDecline('fraudulent'); // => false\n * ```\n */\nexport function isSoftDecline(code: string): boolean {\n return getDeclineCategory(code) === 'SOFT_DECLINE';\n}\n\n/**\n * Extract localized message from a Stripe error object\n *\n * @param error - The Stripe error object (or any caught value)\n * @param locale - The locale to use (default: 'en')\n * @returns User-facing message in the specified locale, or undefined if not found\n *\n * @example\n * ```ts\n * const stripeError = {\n * type: 'StripeCardError',\n * decline_code: 'insufficient_funds',\n * message: 'Your card has insufficient funds.'\n * };\n * const message = getMessageFromStripeError(stripeError, 'ja');\n * console.log(message);\n * // => \"ๅฅใฎใๆฏๆใๆนๆณใไฝฟ็จใใฆใใไธๅบฆใ่ฉฆใใใ ใใใ\"\n * ```\n */\nexport function getMessageFromStripeError(\n error: unknown,\n locale: Locale = 'en',\n): string | undefined {\n if (!isStripeDeclineError(error)) {\n return undefined;\n }\n\n return getDeclineMessage(error.decline_code, locale);\n}\n\n/**\n * Type guard that narrows an unknown error to one carrying a known Stripe decline code\n *\n * Returns true when `error` is an object whose `decline_code` is a valid\n * {@link DeclineCode}. Designed for `catch` blocks: a `StripeCardError` from\n * stripe-node >= 18 (where `decline_code` is a required `string`) narrows\n * straight to {@link StripeDeclineError}; errors from stripe-node <= 17 or\n * plain objects fall back through the same runtime check.\n *\n * @param error - The value to check (e.g. a caught Stripe error)\n * @returns True if the error carries a known decline code\n *\n * @example\n * ```ts\n * try {\n * await stripe.charges.create({ ... });\n * } catch (err) {\n * if (isStripeDeclineError(err)) {\n * // err.decline_code is typed as DeclineCode here\n * console.log(getDeclineMessage(err.decline_code, 'ja'));\n * }\n * }\n * ```\n */\nexport function isStripeDeclineError(error: unknown): error is StripeDeclineError {\n return (\n typeof error === 'object' &&\n error !== null &&\n 'decline_code' in error &&\n typeof (error as StripeError).decline_code === 'string' &&\n isValidDeclineCode((error as StripeDeclineError).decline_code)\n );\n}\n\n/**\n * Extract a validated decline code from a Stripe error object\n *\n * Unlike `getMessageFromStripeError`, this returns the decline code itself\n * (typed as {@link DeclineCode}) so it can be passed to any other helper in\n * this library. Accepts `unknown` so caught errors can be passed directly.\n *\n * @param error - The Stripe error object (or any caught value)\n * @returns The decline code, or undefined if absent or unknown\n *\n * @example\n * ```ts\n * try {\n * await stripe.charges.create({ ... });\n * } catch (err) {\n * const code = getDeclineCodeFromError(err);\n * if (code && isSoftDecline(code)) {\n * // safe to retry\n * }\n * }\n * ```\n */\nexport function getDeclineCodeFromError(error: unknown): DeclineCode | undefined {\n return isStripeDeclineError(error) ? error.decline_code : undefined;\n}\n\n// Export data for advanced use cases\nexport { DECLINE_CODES, DOC_VERSION } from './data/decline-codes.js';\n// Export types\nexport type {\n DeclineCategory,\n DeclineCode,\n DeclineCodeInfo,\n DeclineCodeResult,\n Locale,\n StripeDeclineError,\n StripeError,\n Translation,\n} from './types.js';\n"],"names":["DOC_VERSION","DECLINE_CODES","getDeclineDescription","declineCode","isValidDeclineCode","code","getDeclineMessage","locale","codeInfo","getAllDeclineCodes","getDocVersion","formatDeclineMessage","variables","baseMessage","formattedMessage","key","value","escapedKey","placeholder","getDeclineCategory","isHardDecline","isSoftDecline","getMessageFromStripeError","error","isStripeDeclineError","getDeclineCodeFromError"],"mappings":"gFAOO,MAAMA,EAAc,aAMdC,EAAsD,CACjE,gBAAiB,CACf,YAAa,oCACb,UACE,2HACF,eACE,0FACF,SAAU,eACV,aAAc,CACZ,GAAI,CACF,YAAa,eACb,eACE,iDAAA,CACJ,CACF,EAEF,YAAa,CACX,YAAa,oDACb,UAAW,wEACX,eAAgB,wDAChB,SAAU,eACV,aAAc,CACZ,GAAI,CACF,YAAa,qBACb,eAAgB,yBAAA,CAClB,CACF,EAEF,mBAAoB,CAClB,YAAa,mDACb,UACE,qHACF,eACE,gHACF,SAAU,eACV,aAAc,CACZ,GAAI,CACF,YAAa,yBACb,eACE,+DAAA,CACJ,CACF,EAEF,uBAAwB,CACtB,YAAa,iFACb,UAAW,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AAuB,CACnD,OAAOc,EAAmBd,CAAI,IAAM,cACtC,CAcO,SAASgB,EAAchB,EAAuB,CACnD,OAAOc,EAAmBd,CAAI,IAAM,cACtC,CAqBO,SAASiB,EACdC,EACAhB,EAAiB,KACG,CACpB,GAAKiB,EAAqBD,CAAK,EAI/B,OAAOjB,EAAkBiB,EAAM,aAAchB,CAAM,CACrD,CA0BO,SAASiB,EAAqBD,EAA6C,CAChF,OACE,OAAOA,GAAU,UACjBA,IAAU,MACV,iBAAkBA,GAClB,OAAQA,EAAsB,cAAiB,UAC/CnB,EAAoBmB,EAA6B,YAAY,CAEjE,CAwBO,SAASE,EAAwBF,EAAyC,CAC/E,OAAOC,EAAqBD,CAAK,EAAIA,EAAM,aAAe,MAC5D"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DeclineCategory, DeclineCode, DeclineCodeResult, Locale,
|
|
1
|
+
import type { DeclineCategory, DeclineCode, DeclineCodeResult, Locale, StripeDeclineError } from './types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Get decline code information with description and recommended actions
|
|
4
4
|
*
|
|
@@ -129,7 +129,7 @@ export declare function isSoftDecline(code: string): boolean;
|
|
|
129
129
|
/**
|
|
130
130
|
* Extract localized message from a Stripe error object
|
|
131
131
|
*
|
|
132
|
-
* @param error - The Stripe error object
|
|
132
|
+
* @param error - The Stripe error object (or any caught value)
|
|
133
133
|
* @param locale - The locale to use (default: 'en')
|
|
134
134
|
* @returns User-facing message in the specified locale, or undefined if not found
|
|
135
135
|
*
|
|
@@ -145,7 +145,55 @@ export declare function isSoftDecline(code: string): boolean;
|
|
|
145
145
|
* // => "ๅฅใฎใๆฏๆใๆนๆณใไฝฟ็จใใฆใใไธๅบฆใ่ฉฆใใใ ใใใ"
|
|
146
146
|
* ```
|
|
147
147
|
*/
|
|
148
|
-
export declare function getMessageFromStripeError(error:
|
|
148
|
+
export declare function getMessageFromStripeError(error: unknown, locale?: Locale): string | undefined;
|
|
149
|
+
/**
|
|
150
|
+
* Type guard that narrows an unknown error to one carrying a known Stripe decline code
|
|
151
|
+
*
|
|
152
|
+
* Returns true when `error` is an object whose `decline_code` is a valid
|
|
153
|
+
* {@link DeclineCode}. Designed for `catch` blocks: a `StripeCardError` from
|
|
154
|
+
* stripe-node >= 18 (where `decline_code` is a required `string`) narrows
|
|
155
|
+
* straight to {@link StripeDeclineError}; errors from stripe-node <= 17 or
|
|
156
|
+
* plain objects fall back through the same runtime check.
|
|
157
|
+
*
|
|
158
|
+
* @param error - The value to check (e.g. a caught Stripe error)
|
|
159
|
+
* @returns True if the error carries a known decline code
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* ```ts
|
|
163
|
+
* try {
|
|
164
|
+
* await stripe.charges.create({ ... });
|
|
165
|
+
* } catch (err) {
|
|
166
|
+
* if (isStripeDeclineError(err)) {
|
|
167
|
+
* // err.decline_code is typed as DeclineCode here
|
|
168
|
+
* console.log(getDeclineMessage(err.decline_code, 'ja'));
|
|
169
|
+
* }
|
|
170
|
+
* }
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
173
|
+
export declare function isStripeDeclineError(error: unknown): error is StripeDeclineError;
|
|
174
|
+
/**
|
|
175
|
+
* Extract a validated decline code from a Stripe error object
|
|
176
|
+
*
|
|
177
|
+
* Unlike `getMessageFromStripeError`, this returns the decline code itself
|
|
178
|
+
* (typed as {@link DeclineCode}) so it can be passed to any other helper in
|
|
179
|
+
* this library. Accepts `unknown` so caught errors can be passed directly.
|
|
180
|
+
*
|
|
181
|
+
* @param error - The Stripe error object (or any caught value)
|
|
182
|
+
* @returns The decline code, or undefined if absent or unknown
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* ```ts
|
|
186
|
+
* try {
|
|
187
|
+
* await stripe.charges.create({ ... });
|
|
188
|
+
* } catch (err) {
|
|
189
|
+
* const code = getDeclineCodeFromError(err);
|
|
190
|
+
* if (code && isSoftDecline(code)) {
|
|
191
|
+
* // safe to retry
|
|
192
|
+
* }
|
|
193
|
+
* }
|
|
194
|
+
* ```
|
|
195
|
+
*/
|
|
196
|
+
export declare function getDeclineCodeFromError(error: unknown): DeclineCode | undefined;
|
|
149
197
|
export { DECLINE_CODES, DOC_VERSION } from './data/decline-codes.js';
|
|
150
|
-
export type { DeclineCategory, DeclineCode, DeclineCodeInfo, DeclineCodeResult, Locale, StripeError, Translation, } from './types.js';
|
|
198
|
+
export type { DeclineCategory, DeclineCode, DeclineCodeInfo, DeclineCodeResult, Locale, StripeDeclineError, StripeError, Translation, } from './types.js';
|
|
151
199
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,MAAM,EACN,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,MAAM,EACN,kBAAkB,EAEnB,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,iBAAiB,CAa7E;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,GAAE,MAAa,GAAG,MAAM,GAAG,SAAS,CAYhG;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,IAAI,WAAW,EAAE,CAElD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,WAAW,CAEpE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,MAAM,EACnB,MAAM,GAAE,MAAa,EACrB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACjC,MAAM,GAAG,SAAS,CAqBpB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAM5E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,OAAO,EACd,MAAM,GAAE,MAAa,GACpB,MAAM,GAAG,SAAS,CAMpB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,kBAAkB,CAQhF;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,GAAG,SAAS,CAE/E;AAGD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAErE,YAAY,EACV,eAAe,EACf,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,MAAM,EACN,kBAAkB,EAClB,WAAW,EACX,WAAW,GACZ,MAAM,YAAY,CAAC"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a = "2024-12-18", r = {
|
|
2
2
|
approve_with_id: {
|
|
3
3
|
description: "The payment cannot be authorized.",
|
|
4
4
|
nextSteps: "The payment should be attempted again. If it still cannot be processed, the customer needs to contact their card issuer.",
|
|
@@ -516,72 +516,80 @@ const i = "2024-12-18", r = {
|
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
518
|
};
|
|
519
|
-
function
|
|
520
|
-
if (!e || !
|
|
519
|
+
function y(e) {
|
|
520
|
+
if (!e || !o(e))
|
|
521
521
|
return {
|
|
522
|
-
docVersion:
|
|
522
|
+
docVersion: a,
|
|
523
523
|
code: {}
|
|
524
524
|
};
|
|
525
525
|
const t = r[e];
|
|
526
526
|
return {
|
|
527
|
-
docVersion:
|
|
527
|
+
docVersion: a,
|
|
528
528
|
code: t
|
|
529
529
|
};
|
|
530
530
|
}
|
|
531
531
|
function c(e, t = "en") {
|
|
532
|
-
if (!
|
|
532
|
+
if (!o(e))
|
|
533
533
|
return;
|
|
534
534
|
const n = r[e];
|
|
535
535
|
return t === "en" ? n.nextUserAction : n.translations?.[t]?.nextUserAction;
|
|
536
536
|
}
|
|
537
|
-
function
|
|
537
|
+
function f() {
|
|
538
538
|
return Object.keys(r);
|
|
539
539
|
}
|
|
540
|
-
function
|
|
540
|
+
function o(e) {
|
|
541
541
|
return Object.hasOwn(r, e);
|
|
542
542
|
}
|
|
543
|
-
function
|
|
544
|
-
return
|
|
543
|
+
function x() {
|
|
544
|
+
return a;
|
|
545
545
|
}
|
|
546
|
-
function
|
|
547
|
-
const
|
|
548
|
-
if (!
|
|
546
|
+
function A(e, t = "en", n) {
|
|
547
|
+
const s = c(e, t);
|
|
548
|
+
if (!s)
|
|
549
549
|
return;
|
|
550
550
|
if (!n || Object.keys(n).length === 0)
|
|
551
|
-
return
|
|
552
|
-
let
|
|
553
|
-
for (const [
|
|
554
|
-
const
|
|
555
|
-
|
|
551
|
+
return s;
|
|
552
|
+
let i = s;
|
|
553
|
+
for (const [l, p] of Object.entries(n)) {
|
|
554
|
+
const h = l.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), m = new RegExp(`\\{\\{${h}\\}\\}`, "g");
|
|
555
|
+
i = i.replace(m, p);
|
|
556
556
|
}
|
|
557
|
-
return
|
|
557
|
+
return i;
|
|
558
558
|
}
|
|
559
559
|
function d(e) {
|
|
560
|
-
if (
|
|
560
|
+
if (o(e))
|
|
561
561
|
return r[e].category;
|
|
562
562
|
}
|
|
563
|
-
function
|
|
563
|
+
function _(e) {
|
|
564
564
|
return d(e) === "HARD_DECLINE";
|
|
565
565
|
}
|
|
566
566
|
function g(e) {
|
|
567
567
|
return d(e) === "SOFT_DECLINE";
|
|
568
568
|
}
|
|
569
|
-
function
|
|
570
|
-
if (e
|
|
569
|
+
function E(e, t = "en") {
|
|
570
|
+
if (u(e))
|
|
571
571
|
return c(e.decline_code, t);
|
|
572
572
|
}
|
|
573
|
+
function u(e) {
|
|
574
|
+
return typeof e == "object" && e !== null && "decline_code" in e && typeof e.decline_code == "string" && o(e.decline_code);
|
|
575
|
+
}
|
|
576
|
+
function T(e) {
|
|
577
|
+
return u(e) ? e.decline_code : void 0;
|
|
578
|
+
}
|
|
573
579
|
export {
|
|
574
580
|
r as DECLINE_CODES,
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
581
|
+
a as DOC_VERSION,
|
|
582
|
+
A as formatDeclineMessage,
|
|
583
|
+
f as getAllDeclineCodes,
|
|
578
584
|
d as getDeclineCategory,
|
|
579
|
-
|
|
585
|
+
T as getDeclineCodeFromError,
|
|
586
|
+
y as getDeclineDescription,
|
|
580
587
|
c as getDeclineMessage,
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
588
|
+
x as getDocVersion,
|
|
589
|
+
E as getMessageFromStripeError,
|
|
590
|
+
_ as isHardDecline,
|
|
584
591
|
g as isSoftDecline,
|
|
585
|
-
|
|
592
|
+
u as isStripeDeclineError,
|
|
593
|
+
o as isValidDeclineCode
|
|
586
594
|
};
|
|
587
595
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../src/data/decline-codes.ts","../src/index.ts"],"sourcesContent":["import type { DeclineCode, DeclineCodeInfo } from '../types.js';\n\n/**\n * Stripe API documentation version for decline codes\n * Last updated: 2024-12\n * Reference: https://docs.stripe.com/declines/codes\n */\nexport const DOC_VERSION = '2024-12-18';\n\n/**\n * Complete database of Stripe decline codes with descriptions and recommended actions\n * Includes English and Japanese translations\n */\nexport const DECLINE_CODES: Record<DeclineCode, DeclineCodeInfo> = {\n approve_with_id: {\n description: 'The payment cannot be authorized.',\n nextSteps:\n 'The payment should be attempted again. If it still cannot be processed, the customer needs to contact their card issuer.',\n nextUserAction:\n 'Please try again. If it still cannot be processed, the please contact your card issuer.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ๆฏๆใใฏๆฟ่ชใงใใพใใใ',\n nextUserAction:\n 'ใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n call_issuer: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer needs to contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n card_not_supported: {\n description: 'The card does not support this type of purchase.',\n nextSteps:\n 'The customer needs to contact their card issuer to make sure their card can be used to make this type of purchase.',\n nextUserAction:\n 'Your card issuer may not support this type of purchase, please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏใใฎใฟใคใใฎ่ณผๅ
ฅใใตใใผใใใพใใใ',\n nextUserAction:\n 'ใซใผใ็บ่ก่
ใฏใใฎใฟใคใใฎ่ณผๅ
ฅใใตใใผใใใฆใใชใๅฏ่ฝๆงใใใใพใใ่ฉณ็ดฐใซใคใใฆใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n card_velocity_exceeded: {\n description: 'The customer has exceeded the balance or credit limit available on their card.',\n nextSteps: 'The customer should contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใใฎใซใผใใฎๆฎ้ซใพใใฏใฏใฌใธใใๅถ้ใ่ถ
ใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n currency_not_supported: {\n description: 'The card does not support the specified currency.',\n nextSteps:\n 'The customer needs to check with the issuer whether the card can be used for the type of currency specified.',\n nextUserAction:\n 'Please contact your card issuer to verify this type of currency can be used for this payment.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆๅฎใใใ้่ฒจใใตใใผใใใฆใใพใใใ',\n nextUserAction:\n 'ใใฎๆฏๆใใซใใฎใฟใคใใฎ้่ฒจใไฝฟ็จใงใใใใจใ็ขบ่ชใใใซใฏใใซใผใ็บ่กไผ็คพใซ้ฃ็ตกใใฆใใ ใใใ',\n },\n },\n },\n do_not_honor: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer needs to contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n do_not_try_again: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer should contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n duplicate_transaction: {\n description:\n 'A transaction with identical amount and credit card information was submitted very recently.',\n nextSteps: 'Check to see if a recent payment already exists.',\n nextUserAction: 'Check to see if a recent payment already exists.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใใๆ่ฟใๅไธใฎ้้กใจใฏใฌใธใใใซใผใๆ
ๅ ฑใไฝฟ็จใใๅๅผใ้ไฟกใใใพใใใ',\n nextUserAction: 'ๆ่ฟใฎๆฏๆใใๆขใซๅญๅจใใใใฉใใใ็ขบ่ชใใฆใใ ใใใ',\n },\n },\n },\n expired_card: {\n description: 'The card has expired.',\n nextSteps: 'The customer should use another card.',\n nextUserAction: 'Please use another card.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆ้ๅใใงใใ',\n nextUserAction: 'ๅฅใฎใซใผใใไฝฟ็จใใฆใใ ใใใ',\n },\n },\n },\n fraudulent: {\n description: 'The payment has been declined as Stripe suspects it is fraudulent.',\n nextSteps:\n 'Do not report more detailed information to your customer. Instead, present as you would the generic_decline described below.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ไธๆญฃใจๆใใใใใใๆฏๆใใฏๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n generic_decline: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer needs to contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n incorrect_number: {\n description: 'The card number is incorrect.',\n nextSteps: 'The customer should try again using the correct card number.',\n nextUserAction:\n 'Please check your card numbers and try again. If it still cannot be processed, the please contact your card issuer.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใ็ชๅทใๆญฃใใใใใพใใใ',\n nextUserAction:\n 'ใซใผใ็ชๅทใ็ขบ่ชใใฆใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n incorrect_cvc: {\n description: 'The CVC number is incorrect.',\n nextSteps: 'The customer should try again using the correct CVC.',\n nextUserAction:\n 'Please check your card numbers and try again. If it still cannot be processed, the please contact your card issuer.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'CVC็ชๅทใๆญฃใใใใใพใใใ',\n nextUserAction:\n 'CSC็ชๅทใ็ขบ่ชใใฆใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n incorrect_pin: {\n description:\n 'The PIN entered is incorrect. This decline code only applies to payments made with a card reader.',\n nextSteps: 'The customer should try again using the correct PIN.',\n nextUserAction:\n 'Please check your PIN and try again. If it still cannot be processed, the please contact your card issuer.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'PINใณใผใใๆญฃใใใใใพใใใ',\n nextUserAction:\n 'PINใณใผใใ็ขบ่ชใใฆใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n incorrect_zip: {\n description: 'The ZIP/postal code is incorrect.',\n nextSteps: 'The customer should try again using the correct billing ZIP/postal code.',\n nextUserAction: 'Please try again using the correct ZIP/postal code.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: '้ตไพฟ็ชๅทใๆญฃใใใใใพใใใ',\n nextUserAction: 'ๆญฃใใ้ตไพฟ็ชๅทใไฝฟ็จใใฆใใไธๅบฆใ่ฉฆใใใ ใใใ',\n },\n },\n },\n insufficient_funds: {\n description: 'The card has insufficient funds to complete the purchase.',\n nextSteps: 'The customer should use an alternative payment method.',\n nextUserAction: 'Please try again using an alternative payment method.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฎ่ณผๅ
ฅใซๅฟ
่ฆใช่ณ้ใไธ่ถณใใฆใใพใใ',\n nextUserAction: 'ๅฅใฎใๆฏๆใๆนๆณใไฝฟ็จใใฆใใไธๅบฆใ่ฉฆใใใ ใใใ',\n },\n },\n },\n invalid_account: {\n description: 'The card, or account the card is connected to, is invalid.',\n nextSteps:\n 'The customer needs to contact their card issuer to check that the card is working correctly.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใใพใใฏใซใผใใๆฅ็ถใใใฆใใใขใซใฆใณใใ็กๅนใงใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n invalid_amount: {\n description: 'The payment amount is invalid, or exceeds the amount that is allowed.',\n nextSteps:\n 'If the amount appears to be correct, the customer needs to check with their card issuer that they can make purchases of that amount.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ๆฏๆใ้้กใ็กๅนใงใใใใ่จฑๅฏใใใฆใใ้้กใ่ถ
ใใฆใใพใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n invalid_cvc: {\n description: 'The CVC number is incorrect.',\n nextSteps: 'The customer should try again using the correct CVC.',\n nextUserAction: 'Please try again using the correct CVC.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'CVC็ชๅทใๆญฃใใใใใพใใใ',\n nextUserAction: 'ๆญฃใใCVCใไฝฟ็จใใฆใใไธๅบฆใใ็ดใใฆใใ ใใใ',\n },\n },\n },\n invalid_expiry_year: {\n description: 'The expiration year invalid.',\n nextSteps: 'The customer should try again using the correct expiration date.',\n nextUserAction: 'Please try again using the correct expiration date.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ๆๅนๆ้ใ็กๅนใงใใ',\n nextUserAction: 'ๆญฃใใๆๅนๆ้ใๅ
ฅๅใใฆใใไธๅบฆใ่ฉฆใใใ ใใใ',\n },\n },\n },\n invalid_number: {\n description: 'The card number is incorrect.',\n nextSteps: 'The customer should try again using the correct card number.',\n nextUserAction: 'Please try again using the correct card number.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใ็ชๅทใๆญฃใใใใใพใใใ',\n nextUserAction: 'ๆญฃใใใซใผใ็ชๅทใไฝฟ็จใใฆใใไธๅบฆใใ็ดใใฆใใ ใใใ',\n },\n },\n },\n invalid_pin: {\n description:\n 'The PIN entered is incorrect. This decline code only applies to payments made with a card reader.',\n nextSteps: 'The customer should try again using the correct PIN.',\n nextUserAction: 'Please try again using the correct card PIN.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'PINใณใผใใๆญฃใใใใใพใใใ',\n nextUserAction: 'ๆญฃใใPINใณใผใใไฝฟ็จใใฆใใไธๅบฆใใ็ดใใฆใใ ใใใ',\n },\n },\n },\n issuer_not_available: {\n description: 'The card issuer could not be reached, so the payment could not be authorized.',\n nextSteps:\n 'The payment should be attempted again. If it still cannot be processed, the customer needs to contact their card issuer.',\n nextUserAction:\n 'Please try again. If it still cannot be processed, the please contact your card issuer.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใ็บ่ก่
ใซ้ฃ็ตกใงใใชใใฃใใใใๆฏๆใใๆฟ่ชใงใใพใใใงใใใ',\n nextUserAction:\n 'ใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n lost_card: {\n description: 'The payment has been declined because the card is reported lost.',\n nextSteps:\n 'The specific reason for the decline should not be reported to the customer. Instead, it needs to be presented as a generic decline.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n merchant_blacklist: {\n description:\n \"The payment has been declined because it matches a value on the Stripe user's blocklist.\",\n nextSteps:\n 'Do not report more detailed information to your customer. Instead, present as you would the generic_decline described above.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n new_account_information_available: {\n description: 'The card, or account the card is connected to, is invalid.',\n nextSteps: 'The customer needs to contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใใพใใฏใซใผใใๆฅ็ถใใใฆใใใขใซใฆใณใใ็กๅนใงใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n no_action_taken: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer should contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n not_permitted: {\n description: 'The payment is not permitted.',\n nextSteps: 'The customer needs to contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ๆฏๆใใฏ่จฑๅฏใใใฆใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n pickup_card: {\n description:\n 'The card cannot be used to make this payment (it is possible it has been reported lost or stolen).',\n nextSteps: 'The customer needs to contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description:\n 'ใซใผใใงใใฎๆฏๆใใ่กใใใจใฏใงใใพใใ๏ผ็ดๅคฑใพใใฏ็้ฃใซใใฃใใจๅ ฑๅใใใฆใใๅฏ่ฝๆงใใใใพใ๏ผใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n pin_try_exceeded: {\n description: 'The allowable number of PIN tries has been exceeded.',\n nextSteps: 'The customer must use another card or method of payment.',\n nextUserAction: 'Please use another card or method of payment.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'PIN่ฉฆ่กๅๆฐใฎไธ้ใ่ถ
ใใพใใใ',\n nextUserAction: 'ๅฅใฎใซใผใใพใใฏใๆฏๆใๆนๆณใใๅฉ็จใใ ใใใ',\n },\n },\n },\n processing_error: {\n description: 'An error occurred while processing the card.',\n nextSteps:\n 'The payment should be attempted again. If it still cannot be processed, try again later.',\n nextUserAction:\n 'Please try again. If it still cannot be processed, the please contact your card issuer.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฎๅฆ็ไธญใซใจใฉใผใ็บ็ใใพใใใ',\n nextUserAction:\n 'ใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n reenter_transaction: {\n description: 'The payment could not be processed by the issuer for an unknown reason.',\n nextSteps:\n 'The payment should be attempted again. If it still cannot be processed, the customer needs to contact their card issuer.',\n nextUserAction:\n 'Please try again. If it still cannot be processed, the please contact your card issuer.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ๅๅ ไธๆใฎใใใ็บ่ก่
ใๆฏๆใใๅฆ็ใงใใพใใใงใใใ',\n nextUserAction:\n 'ใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n restricted_card: {\n description:\n 'The card cannot be used to make this payment (it is possible it has been reported lost or stolen).',\n nextSteps: 'The customer needs to contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description:\n 'ใซใผใใงใใฎๆฏๆใใ่กใใใจใฏใงใใพใใ๏ผ็ดๅคฑใพใใฏ็้ฃใซใใฃใใจๅ ฑๅใใใฆใใๅฏ่ฝๆงใใใใพใ๏ผใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n revocation_of_all_authorizations: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer should contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n revocation_of_authorization: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer should contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n security_violation: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer needs to contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n service_not_allowed: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer should contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n stolen_card: {\n description: 'The payment has been declined because the card is reported stolen.',\n nextSteps:\n 'The specific reason for the decline should not be reported to the customer. Instead, it needs to be presented as a generic decline.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n stop_payment_order: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer should contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n testmode_decline: {\n description: 'A Stripe test card number was used.',\n nextSteps: 'A genuine card must be used to make a payment.',\n nextUserAction: 'A genuine card must be used to make a payment.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'Stripeใในใใซใผใ็ชๅทใไฝฟ็จใใพใใใ',\n nextUserAction: 'ๆฏๆใใซใฏๆฌ็ฉใฎใซใผใใไฝฟ็จใใๅฟ
่ฆใใใใพใใ',\n },\n },\n },\n transaction_not_allowed: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer needs to contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n try_again_later: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps:\n 'Ask the customer to attempt the payment again. If subsequent payments are declined, the customer should contact their card issuer for more information.',\n nextUserAction:\n 'Please try again. If it still cannot be processed, the please contact your card issuer.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction:\n 'ใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n withdrawal_count_limit_exceeded: {\n description: 'The customer has exceeded the balance or credit limit available on their card.',\n nextSteps: 'The customer should use an alternative payment method.',\n nextUserAction: 'Please use another card or contact your card issuer for more information.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใใฎใซใผใใฎๆฎ้ซใพใใฏใฏใฌใธใใๅถ้ใ่ถ
ใใพใใใ',\n nextUserAction: 'ๅฅใฎใซใผใใไฝฟ็จใใใใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n};\n","import { DECLINE_CODES, DOC_VERSION } from './data/decline-codes.js';\nimport type {\n DeclineCategory,\n DeclineCode,\n DeclineCodeResult,\n Locale,\n StripeError,\n} from './types.js';\n\n/**\n * Get decline code information with description and recommended actions\n *\n * @param declineCode - The Stripe decline code to look up\n * @returns Object containing the decline code information and documentation version\n *\n * @example\n * ```ts\n * const result = getDeclineDescription('insufficient_funds');\n * console.log(result.code.description);\n * // => \"The card has insufficient funds to complete the purchase.\"\n * console.log(result.code.nextUserAction);\n * // => \"Please try again using an alternative payment method.\"\n * ```\n */\nexport function getDeclineDescription(declineCode?: string): DeclineCodeResult {\n if (!declineCode || !isValidDeclineCode(declineCode)) {\n return {\n docVersion: DOC_VERSION,\n code: {},\n };\n }\n\n const code = DECLINE_CODES[declineCode];\n return {\n docVersion: DOC_VERSION,\n code,\n };\n}\n\n/**\n * Get localized decline code message for end users\n *\n * @param declineCode - The Stripe decline code\n * @param locale - The locale to use (default: 'en')\n * @returns User-facing message in the specified locale, or undefined if not found\n *\n * @example\n * ```ts\n * const message = getDeclineMessage('insufficient_funds', 'ja');\n * console.log(message);\n * // => \"ๅฅใฎใๆฏๆใๆนๆณใไฝฟ็จใใฆใใไธๅบฆใ่ฉฆใใใ ใใใ\"\n * ```\n */\nexport function getDeclineMessage(declineCode: string, locale: Locale = 'en'): string | undefined {\n if (!isValidDeclineCode(declineCode)) {\n return undefined;\n }\n\n const codeInfo = DECLINE_CODES[declineCode];\n\n if (locale === 'en') {\n return codeInfo.nextUserAction;\n }\n\n return codeInfo.translations?.[locale]?.nextUserAction;\n}\n\n/**\n * Get all available decline codes\n *\n * @returns Array of all supported decline code strings\n *\n * @example\n * ```ts\n * const codes = getAllDeclineCodes();\n * console.log(codes.length); // => 44\n * console.log(codes.includes('insufficient_funds')); // => true\n * ```\n */\nexport function getAllDeclineCodes(): DeclineCode[] {\n return Object.keys(DECLINE_CODES) as DeclineCode[];\n}\n\n/**\n * Check if a decline code is valid\n *\n * @param code - The code to validate\n * @returns True if the code exists in the database\n *\n * @example\n * ```ts\n * isValidDeclineCode('insufficient_funds'); // => true\n * isValidDeclineCode('invalid_code'); // => false\n * ```\n */\nexport function isValidDeclineCode(code: string): code is DeclineCode {\n return Object.hasOwn(DECLINE_CODES, code);\n}\n\n/**\n * Get the documentation version for the decline codes data\n *\n * @returns The Stripe API documentation version string\n *\n * @example\n * ```ts\n * const version = getDocVersion();\n * console.log(version); // => \"2024-12-18\"\n * ```\n */\nexport function getDocVersion(): string {\n return DOC_VERSION;\n}\n\n/**\n * Format a decline message with custom template variables\n *\n * @param declineCode - The Stripe decline code\n * @param locale - The locale to use (default: 'en')\n * @param variables - Optional variables to replace in the message template\n * @returns Formatted user-facing message with variables replaced\n *\n * @example\n * ```ts\n * const message = formatDeclineMessage('insufficient_funds', 'en', {\n * merchantName: 'Acme Store',\n * supportEmail: 'support@acme.com'\n * });\n * console.log(message);\n * // => \"Please try again using an alternative payment method.\"\n * ```\n */\nexport function formatDeclineMessage(\n declineCode: string,\n locale: Locale = 'en',\n variables?: Record<string, string>,\n): string | undefined {\n const baseMessage = getDeclineMessage(declineCode, locale);\n\n if (!baseMessage) {\n return undefined;\n }\n\n if (!variables || Object.keys(variables).length === 0) {\n return baseMessage;\n }\n\n // Replace variables in the format {{variableName}}\n let formattedMessage = baseMessage;\n for (const [key, value] of Object.entries(variables)) {\n // Escape special regex characters in the key\n const escapedKey = key.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n const placeholder = new RegExp(`\\\\{\\\\{${escapedKey}\\\\}\\\\}`, 'g');\n formattedMessage = formattedMessage.replace(placeholder, value);\n }\n\n return formattedMessage;\n}\n\n/**\n * Get the category of a decline code (SOFT_DECLINE or HARD_DECLINE)\n *\n * @param code - The decline code to categorize\n * @returns The category of the decline code, or undefined if invalid\n *\n * @example\n * ```ts\n * getDeclineCategory('insufficient_funds'); // => 'SOFT_DECLINE'\n * getDeclineCategory('fraudulent'); // => 'HARD_DECLINE'\n * ```\n */\nexport function getDeclineCategory(code: string): DeclineCategory | undefined {\n if (!isValidDeclineCode(code)) {\n return undefined;\n }\n\n return DECLINE_CODES[code].category;\n}\n\n/**\n * Check if a decline code is a hard decline (permanent, should not retry)\n *\n * @param code - The decline code to check\n * @returns True if the code is a hard decline\n *\n * @example\n * ```ts\n * isHardDecline('fraudulent'); // => true\n * isHardDecline('insufficient_funds'); // => false\n * ```\n */\nexport function isHardDecline(code: string): boolean {\n return getDeclineCategory(code) === 'HARD_DECLINE';\n}\n\n/**\n * Check if a decline code is a soft decline (temporary, can retry)\n *\n * @param code - The decline code to check\n * @returns True if the code is a soft decline\n *\n * @example\n * ```ts\n * isSoftDecline('insufficient_funds'); // => true\n * isSoftDecline('fraudulent'); // => false\n * ```\n */\nexport function isSoftDecline(code: string): boolean {\n return getDeclineCategory(code) === 'SOFT_DECLINE';\n}\n\n/**\n * Extract localized message from a Stripe error object\n *\n * @param error - The Stripe error object\n * @param locale - The locale to use (default: 'en')\n * @returns User-facing message in the specified locale, or undefined if not found\n *\n * @example\n * ```ts\n * const stripeError = {\n * type: 'StripeCardError',\n * decline_code: 'insufficient_funds',\n * message: 'Your card has insufficient funds.'\n * };\n * const message = getMessageFromStripeError(stripeError, 'ja');\n * console.log(message);\n * // => \"ๅฅใฎใๆฏๆใๆนๆณใไฝฟ็จใใฆใใไธๅบฆใ่ฉฆใใใ ใใใ\"\n * ```\n */\nexport function getMessageFromStripeError(\n error: StripeError,\n locale: Locale = 'en',\n): string | undefined {\n if (!error.decline_code) {\n return undefined;\n }\n\n return getDeclineMessage(error.decline_code, locale);\n}\n\n// Export data for advanced use cases\nexport { DECLINE_CODES, DOC_VERSION } from './data/decline-codes.js';\n// Export types\nexport type {\n DeclineCategory,\n DeclineCode,\n DeclineCodeInfo,\n DeclineCodeResult,\n Locale,\n StripeError,\n Translation,\n} from './types.js';\n"],"names":["DOC_VERSION","DECLINE_CODES","getDeclineDescription","declineCode","isValidDeclineCode","code","getDeclineMessage","locale","codeInfo","getAllDeclineCodes","getDocVersion","formatDeclineMessage","variables","baseMessage","formattedMessage","key","value","escapedKey","placeholder","getDeclineCategory","isHardDecline","isSoftDecline","getMessageFromStripeError","error"],"mappings":"AAOO,MAAMA,IAAc,cAMdC,IAAsD;AAAA,EACjE,iBAAiB;AAAA,IACf,aAAa;AAAA,IACb,WACE;AAAA,IACF,gBACE;AAAA,IACF,UAAU;AAAA,IACV,cAAc;AAAA,MACZ,IAAI;AAAA,QACF,aAAa;AAAA,QACb,gBACE;AAAA,MAAA;AAAA,IACJ;AAAA,EACF;AAAA,EAEF,aAAa;AAAA,IACX,aAAa;AAAA,IACb,WAAW;AAAA,IACX,gBAAgB;AAAA,IAChB,UAAU;AAAA,IACV,cAAc;AAAA,MACZ,IAAI;AAAA,QACF,aAAa;AAAA,QACb,gBAAgB;AAAA,MAAA;AAAA,IAClB;AAAA,EACF;AAAA,EAEF,oBAAoB;AAAA,IAClB,aAAa;AAAA,IACb,WACE;AAAA,IACF,gBACE;AAAA,IACF,UAAU;AAAA,IACV,cAAc;AAAA,MACZ,IAAI;AAAA,QACF,aAAa;AAAA,QACb,gBACE;AAAA,MAAA;AAAA,IACJ;AAAA,EACF;AAAA,EAEF,wBAAwB;AAAA,IACtB,aAAa;AAAA,IACb,WAAW;AAAA,IACX,gBAAgB;AAAA,IAChB,UAAU;AAAA,IACV,cAAc;AAAA,MACZ,IAAI;AAAA,QACF,aAAa;AAAA,QACb,gBAAgB;AAAA,MAAA;AAAA,IAClB;AAAA,EACF;AAAA,EAEF,wBAAwB;AAAA,IACtB,aAAa;AAAA,IACb,WACE;AAAA,IACF,gBACE;AAAA,IACF,UAAU;AAAA,IACV,cAAc;AAAA,MACZ,IAAI;AAAA,QACF,aAAa;AAAA,QACb,gBACE;AAAA,MAAA;AAAA,IACJ;AAAA,EACF;AAAA,EAEF,cAAc;AAAA,IACZ,aAAa;AAAA,IACb,WAAW;AAAA,IACX,gBAAgB;AAAA,IAChB,UAAU;AAA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;AAqBO,SAASiB,EACdC,GACAhB,IAAiB,MACG;AACpB,MAAKgB,EAAM;AAIX,WAAOjB,EAAkBiB,EAAM,cAAchB,CAAM;AACrD;"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../src/data/decline-codes.ts","../src/index.ts"],"sourcesContent":["import type { DeclineCode, DeclineCodeInfo } from '../types.js';\n\n/**\n * Stripe API documentation version for decline codes\n * Last updated: 2024-12\n * Reference: https://docs.stripe.com/declines/codes\n */\nexport const DOC_VERSION = '2024-12-18';\n\n/**\n * Complete database of Stripe decline codes with descriptions and recommended actions\n * Includes English and Japanese translations\n */\nexport const DECLINE_CODES: Record<DeclineCode, DeclineCodeInfo> = {\n approve_with_id: {\n description: 'The payment cannot be authorized.',\n nextSteps:\n 'The payment should be attempted again. If it still cannot be processed, the customer needs to contact their card issuer.',\n nextUserAction:\n 'Please try again. If it still cannot be processed, the please contact your card issuer.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ๆฏๆใใฏๆฟ่ชใงใใพใใใ',\n nextUserAction:\n 'ใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n call_issuer: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer needs to contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n card_not_supported: {\n description: 'The card does not support this type of purchase.',\n nextSteps:\n 'The customer needs to contact their card issuer to make sure their card can be used to make this type of purchase.',\n nextUserAction:\n 'Your card issuer may not support this type of purchase, please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏใใฎใฟใคใใฎ่ณผๅ
ฅใใตใใผใใใพใใใ',\n nextUserAction:\n 'ใซใผใ็บ่ก่
ใฏใใฎใฟใคใใฎ่ณผๅ
ฅใใตใใผใใใฆใใชใๅฏ่ฝๆงใใใใพใใ่ฉณ็ดฐใซใคใใฆใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n card_velocity_exceeded: {\n description: 'The customer has exceeded the balance or credit limit available on their card.',\n nextSteps: 'The customer should contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใใฎใซใผใใฎๆฎ้ซใพใใฏใฏใฌใธใใๅถ้ใ่ถ
ใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n currency_not_supported: {\n description: 'The card does not support the specified currency.',\n nextSteps:\n 'The customer needs to check with the issuer whether the card can be used for the type of currency specified.',\n nextUserAction:\n 'Please contact your card issuer to verify this type of currency can be used for this payment.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆๅฎใใใ้่ฒจใใตใใผใใใฆใใพใใใ',\n nextUserAction:\n 'ใใฎๆฏๆใใซใใฎใฟใคใใฎ้่ฒจใไฝฟ็จใงใใใใจใ็ขบ่ชใใใซใฏใใซใผใ็บ่กไผ็คพใซ้ฃ็ตกใใฆใใ ใใใ',\n },\n },\n },\n do_not_honor: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer needs to contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n do_not_try_again: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer should contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n duplicate_transaction: {\n description:\n 'A transaction with identical amount and credit card information was submitted very recently.',\n nextSteps: 'Check to see if a recent payment already exists.',\n nextUserAction: 'Check to see if a recent payment already exists.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใใๆ่ฟใๅไธใฎ้้กใจใฏใฌใธใใใซใผใๆ
ๅ ฑใไฝฟ็จใใๅๅผใ้ไฟกใใใพใใใ',\n nextUserAction: 'ๆ่ฟใฎๆฏๆใใๆขใซๅญๅจใใใใฉใใใ็ขบ่ชใใฆใใ ใใใ',\n },\n },\n },\n expired_card: {\n description: 'The card has expired.',\n nextSteps: 'The customer should use another card.',\n nextUserAction: 'Please use another card.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆ้ๅใใงใใ',\n nextUserAction: 'ๅฅใฎใซใผใใไฝฟ็จใใฆใใ ใใใ',\n },\n },\n },\n fraudulent: {\n description: 'The payment has been declined as Stripe suspects it is fraudulent.',\n nextSteps:\n 'Do not report more detailed information to your customer. Instead, present as you would the generic_decline described below.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ไธๆญฃใจๆใใใใใใๆฏๆใใฏๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n generic_decline: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer needs to contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n incorrect_number: {\n description: 'The card number is incorrect.',\n nextSteps: 'The customer should try again using the correct card number.',\n nextUserAction:\n 'Please check your card numbers and try again. If it still cannot be processed, the please contact your card issuer.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใ็ชๅทใๆญฃใใใใใพใใใ',\n nextUserAction:\n 'ใซใผใ็ชๅทใ็ขบ่ชใใฆใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n incorrect_cvc: {\n description: 'The CVC number is incorrect.',\n nextSteps: 'The customer should try again using the correct CVC.',\n nextUserAction:\n 'Please check your card numbers and try again. If it still cannot be processed, the please contact your card issuer.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'CVC็ชๅทใๆญฃใใใใใพใใใ',\n nextUserAction:\n 'CSC็ชๅทใ็ขบ่ชใใฆใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n incorrect_pin: {\n description:\n 'The PIN entered is incorrect. This decline code only applies to payments made with a card reader.',\n nextSteps: 'The customer should try again using the correct PIN.',\n nextUserAction:\n 'Please check your PIN and try again. If it still cannot be processed, the please contact your card issuer.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'PINใณใผใใๆญฃใใใใใพใใใ',\n nextUserAction:\n 'PINใณใผใใ็ขบ่ชใใฆใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n incorrect_zip: {\n description: 'The ZIP/postal code is incorrect.',\n nextSteps: 'The customer should try again using the correct billing ZIP/postal code.',\n nextUserAction: 'Please try again using the correct ZIP/postal code.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: '้ตไพฟ็ชๅทใๆญฃใใใใใพใใใ',\n nextUserAction: 'ๆญฃใใ้ตไพฟ็ชๅทใไฝฟ็จใใฆใใไธๅบฆใ่ฉฆใใใ ใใใ',\n },\n },\n },\n insufficient_funds: {\n description: 'The card has insufficient funds to complete the purchase.',\n nextSteps: 'The customer should use an alternative payment method.',\n nextUserAction: 'Please try again using an alternative payment method.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฎ่ณผๅ
ฅใซๅฟ
่ฆใช่ณ้ใไธ่ถณใใฆใใพใใ',\n nextUserAction: 'ๅฅใฎใๆฏๆใๆนๆณใไฝฟ็จใใฆใใไธๅบฆใ่ฉฆใใใ ใใใ',\n },\n },\n },\n invalid_account: {\n description: 'The card, or account the card is connected to, is invalid.',\n nextSteps:\n 'The customer needs to contact their card issuer to check that the card is working correctly.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใใพใใฏใซใผใใๆฅ็ถใใใฆใใใขใซใฆใณใใ็กๅนใงใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n invalid_amount: {\n description: 'The payment amount is invalid, or exceeds the amount that is allowed.',\n nextSteps:\n 'If the amount appears to be correct, the customer needs to check with their card issuer that they can make purchases of that amount.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ๆฏๆใ้้กใ็กๅนใงใใใใ่จฑๅฏใใใฆใใ้้กใ่ถ
ใใฆใใพใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n invalid_cvc: {\n description: 'The CVC number is incorrect.',\n nextSteps: 'The customer should try again using the correct CVC.',\n nextUserAction: 'Please try again using the correct CVC.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'CVC็ชๅทใๆญฃใใใใใพใใใ',\n nextUserAction: 'ๆญฃใใCVCใไฝฟ็จใใฆใใไธๅบฆใใ็ดใใฆใใ ใใใ',\n },\n },\n },\n invalid_expiry_year: {\n description: 'The expiration year invalid.',\n nextSteps: 'The customer should try again using the correct expiration date.',\n nextUserAction: 'Please try again using the correct expiration date.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ๆๅนๆ้ใ็กๅนใงใใ',\n nextUserAction: 'ๆญฃใใๆๅนๆ้ใๅ
ฅๅใใฆใใไธๅบฆใ่ฉฆใใใ ใใใ',\n },\n },\n },\n invalid_number: {\n description: 'The card number is incorrect.',\n nextSteps: 'The customer should try again using the correct card number.',\n nextUserAction: 'Please try again using the correct card number.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใ็ชๅทใๆญฃใใใใใพใใใ',\n nextUserAction: 'ๆญฃใใใซใผใ็ชๅทใไฝฟ็จใใฆใใไธๅบฆใใ็ดใใฆใใ ใใใ',\n },\n },\n },\n invalid_pin: {\n description:\n 'The PIN entered is incorrect. This decline code only applies to payments made with a card reader.',\n nextSteps: 'The customer should try again using the correct PIN.',\n nextUserAction: 'Please try again using the correct card PIN.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'PINใณใผใใๆญฃใใใใใพใใใ',\n nextUserAction: 'ๆญฃใใPINใณใผใใไฝฟ็จใใฆใใไธๅบฆใใ็ดใใฆใใ ใใใ',\n },\n },\n },\n issuer_not_available: {\n description: 'The card issuer could not be reached, so the payment could not be authorized.',\n nextSteps:\n 'The payment should be attempted again. If it still cannot be processed, the customer needs to contact their card issuer.',\n nextUserAction:\n 'Please try again. If it still cannot be processed, the please contact your card issuer.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใ็บ่ก่
ใซ้ฃ็ตกใงใใชใใฃใใใใๆฏๆใใๆฟ่ชใงใใพใใใงใใใ',\n nextUserAction:\n 'ใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n lost_card: {\n description: 'The payment has been declined because the card is reported lost.',\n nextSteps:\n 'The specific reason for the decline should not be reported to the customer. Instead, it needs to be presented as a generic decline.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n merchant_blacklist: {\n description:\n \"The payment has been declined because it matches a value on the Stripe user's blocklist.\",\n nextSteps:\n 'Do not report more detailed information to your customer. Instead, present as you would the generic_decline described above.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n new_account_information_available: {\n description: 'The card, or account the card is connected to, is invalid.',\n nextSteps: 'The customer needs to contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใใพใใฏใซใผใใๆฅ็ถใใใฆใใใขใซใฆใณใใ็กๅนใงใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n no_action_taken: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer should contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n not_permitted: {\n description: 'The payment is not permitted.',\n nextSteps: 'The customer needs to contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ๆฏๆใใฏ่จฑๅฏใใใฆใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n pickup_card: {\n description:\n 'The card cannot be used to make this payment (it is possible it has been reported lost or stolen).',\n nextSteps: 'The customer needs to contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description:\n 'ใซใผใใงใใฎๆฏๆใใ่กใใใจใฏใงใใพใใ๏ผ็ดๅคฑใพใใฏ็้ฃใซใใฃใใจๅ ฑๅใใใฆใใๅฏ่ฝๆงใใใใพใ๏ผใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n pin_try_exceeded: {\n description: 'The allowable number of PIN tries has been exceeded.',\n nextSteps: 'The customer must use another card or method of payment.',\n nextUserAction: 'Please use another card or method of payment.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'PIN่ฉฆ่กๅๆฐใฎไธ้ใ่ถ
ใใพใใใ',\n nextUserAction: 'ๅฅใฎใซใผใใพใใฏใๆฏๆใๆนๆณใใๅฉ็จใใ ใใใ',\n },\n },\n },\n processing_error: {\n description: 'An error occurred while processing the card.',\n nextSteps:\n 'The payment should be attempted again. If it still cannot be processed, try again later.',\n nextUserAction:\n 'Please try again. If it still cannot be processed, the please contact your card issuer.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฎๅฆ็ไธญใซใจใฉใผใ็บ็ใใพใใใ',\n nextUserAction:\n 'ใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n reenter_transaction: {\n description: 'The payment could not be processed by the issuer for an unknown reason.',\n nextSteps:\n 'The payment should be attempted again. If it still cannot be processed, the customer needs to contact their card issuer.',\n nextUserAction:\n 'Please try again. If it still cannot be processed, the please contact your card issuer.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ๅๅ ไธๆใฎใใใ็บ่ก่
ใๆฏๆใใๅฆ็ใงใใพใใใงใใใ',\n nextUserAction:\n 'ใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n restricted_card: {\n description:\n 'The card cannot be used to make this payment (it is possible it has been reported lost or stolen).',\n nextSteps: 'The customer needs to contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description:\n 'ใซใผใใงใใฎๆฏๆใใ่กใใใจใฏใงใใพใใ๏ผ็ดๅคฑใพใใฏ็้ฃใซใใฃใใจๅ ฑๅใใใฆใใๅฏ่ฝๆงใใใใพใ๏ผใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n revocation_of_all_authorizations: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer should contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n revocation_of_authorization: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer should contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n security_violation: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer needs to contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n service_not_allowed: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer should contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n stolen_card: {\n description: 'The payment has been declined because the card is reported stolen.',\n nextSteps:\n 'The specific reason for the decline should not be reported to the customer. Instead, it needs to be presented as a generic decline.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n stop_payment_order: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer should contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n testmode_decline: {\n description: 'A Stripe test card number was used.',\n nextSteps: 'A genuine card must be used to make a payment.',\n nextUserAction: 'A genuine card must be used to make a payment.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'Stripeใในใใซใผใ็ชๅทใไฝฟ็จใใพใใใ',\n nextUserAction: 'ๆฏๆใใซใฏๆฌ็ฉใฎใซใผใใไฝฟ็จใใๅฟ
่ฆใใใใพใใ',\n },\n },\n },\n transaction_not_allowed: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps: 'The customer needs to contact their card issuer for more information.',\n nextUserAction: 'Please contact your card issuer for more information.',\n category: 'HARD_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction: '่ฉณใใใฏใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n try_again_later: {\n description: 'The card has been declined for an unknown reason.',\n nextSteps:\n 'Ask the customer to attempt the payment again. If subsequent payments are declined, the customer should contact their card issuer for more information.',\n nextUserAction:\n 'Please try again. If it still cannot be processed, the please contact your card issuer.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใซใผใใฏๆช็ฅใฎ็็ฑใงๆๅฆใใใพใใใ',\n nextUserAction:\n 'ใใไธๅบฆใใ็ดใใฆใใ ใใใใใใงใๅฆ็ใงใใชใๅ ดๅใฏใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n withdrawal_count_limit_exceeded: {\n description: 'The customer has exceeded the balance or credit limit available on their card.',\n nextSteps: 'The customer should use an alternative payment method.',\n nextUserAction: 'Please use another card or contact your card issuer for more information.',\n category: 'SOFT_DECLINE',\n translations: {\n ja: {\n description: 'ใใฎใซใผใใฎๆฎ้ซใพใใฏใฏใฌใธใใๅถ้ใ่ถ
ใใพใใใ',\n nextUserAction: 'ๅฅใฎใซใผใใไฝฟ็จใใใใใซใผใ็บ่กไผ็คพใซใๅใๅใใใใ ใใใ',\n },\n },\n },\n};\n","import { DECLINE_CODES, DOC_VERSION } from './data/decline-codes.js';\nimport type {\n DeclineCategory,\n DeclineCode,\n DeclineCodeResult,\n Locale,\n StripeDeclineError,\n StripeError,\n} from './types.js';\n\n/**\n * Get decline code information with description and recommended actions\n *\n * @param declineCode - The Stripe decline code to look up\n * @returns Object containing the decline code information and documentation version\n *\n * @example\n * ```ts\n * const result = getDeclineDescription('insufficient_funds');\n * console.log(result.code.description);\n * // => \"The card has insufficient funds to complete the purchase.\"\n * console.log(result.code.nextUserAction);\n * // => \"Please try again using an alternative payment method.\"\n * ```\n */\nexport function getDeclineDescription(declineCode?: string): DeclineCodeResult {\n if (!declineCode || !isValidDeclineCode(declineCode)) {\n return {\n docVersion: DOC_VERSION,\n code: {},\n };\n }\n\n const code = DECLINE_CODES[declineCode];\n return {\n docVersion: DOC_VERSION,\n code,\n };\n}\n\n/**\n * Get localized decline code message for end users\n *\n * @param declineCode - The Stripe decline code\n * @param locale - The locale to use (default: 'en')\n * @returns User-facing message in the specified locale, or undefined if not found\n *\n * @example\n * ```ts\n * const message = getDeclineMessage('insufficient_funds', 'ja');\n * console.log(message);\n * // => \"ๅฅใฎใๆฏๆใๆนๆณใไฝฟ็จใใฆใใไธๅบฆใ่ฉฆใใใ ใใใ\"\n * ```\n */\nexport function getDeclineMessage(declineCode: string, locale: Locale = 'en'): string | undefined {\n if (!isValidDeclineCode(declineCode)) {\n return undefined;\n }\n\n const codeInfo = DECLINE_CODES[declineCode];\n\n if (locale === 'en') {\n return codeInfo.nextUserAction;\n }\n\n return codeInfo.translations?.[locale]?.nextUserAction;\n}\n\n/**\n * Get all available decline codes\n *\n * @returns Array of all supported decline code strings\n *\n * @example\n * ```ts\n * const codes = getAllDeclineCodes();\n * console.log(codes.length); // => 44\n * console.log(codes.includes('insufficient_funds')); // => true\n * ```\n */\nexport function getAllDeclineCodes(): DeclineCode[] {\n return Object.keys(DECLINE_CODES) as DeclineCode[];\n}\n\n/**\n * Check if a decline code is valid\n *\n * @param code - The code to validate\n * @returns True if the code exists in the database\n *\n * @example\n * ```ts\n * isValidDeclineCode('insufficient_funds'); // => true\n * isValidDeclineCode('invalid_code'); // => false\n * ```\n */\nexport function isValidDeclineCode(code: string): code is DeclineCode {\n return Object.hasOwn(DECLINE_CODES, code);\n}\n\n/**\n * Get the documentation version for the decline codes data\n *\n * @returns The Stripe API documentation version string\n *\n * @example\n * ```ts\n * const version = getDocVersion();\n * console.log(version); // => \"2024-12-18\"\n * ```\n */\nexport function getDocVersion(): string {\n return DOC_VERSION;\n}\n\n/**\n * Format a decline message with custom template variables\n *\n * @param declineCode - The Stripe decline code\n * @param locale - The locale to use (default: 'en')\n * @param variables - Optional variables to replace in the message template\n * @returns Formatted user-facing message with variables replaced\n *\n * @example\n * ```ts\n * const message = formatDeclineMessage('insufficient_funds', 'en', {\n * merchantName: 'Acme Store',\n * supportEmail: 'support@acme.com'\n * });\n * console.log(message);\n * // => \"Please try again using an alternative payment method.\"\n * ```\n */\nexport function formatDeclineMessage(\n declineCode: string,\n locale: Locale = 'en',\n variables?: Record<string, string>,\n): string | undefined {\n const baseMessage = getDeclineMessage(declineCode, locale);\n\n if (!baseMessage) {\n return undefined;\n }\n\n if (!variables || Object.keys(variables).length === 0) {\n return baseMessage;\n }\n\n // Replace variables in the format {{variableName}}\n let formattedMessage = baseMessage;\n for (const [key, value] of Object.entries(variables)) {\n // Escape special regex characters in the key\n const escapedKey = key.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n const placeholder = new RegExp(`\\\\{\\\\{${escapedKey}\\\\}\\\\}`, 'g');\n formattedMessage = formattedMessage.replace(placeholder, value);\n }\n\n return formattedMessage;\n}\n\n/**\n * Get the category of a decline code (SOFT_DECLINE or HARD_DECLINE)\n *\n * @param code - The decline code to categorize\n * @returns The category of the decline code, or undefined if invalid\n *\n * @example\n * ```ts\n * getDeclineCategory('insufficient_funds'); // => 'SOFT_DECLINE'\n * getDeclineCategory('fraudulent'); // => 'HARD_DECLINE'\n * ```\n */\nexport function getDeclineCategory(code: string): DeclineCategory | undefined {\n if (!isValidDeclineCode(code)) {\n return undefined;\n }\n\n return DECLINE_CODES[code].category;\n}\n\n/**\n * Check if a decline code is a hard decline (permanent, should not retry)\n *\n * @param code - The decline code to check\n * @returns True if the code is a hard decline\n *\n * @example\n * ```ts\n * isHardDecline('fraudulent'); // => true\n * isHardDecline('insufficient_funds'); // => false\n * ```\n */\nexport function isHardDecline(code: string): boolean {\n return getDeclineCategory(code) === 'HARD_DECLINE';\n}\n\n/**\n * Check if a decline code is a soft decline (temporary, can retry)\n *\n * @param code - The decline code to check\n * @returns True if the code is a soft decline\n *\n * @example\n * ```ts\n * isSoftDecline('insufficient_funds'); // => true\n * isSoftDecline('fraudulent'); // => false\n * ```\n */\nexport function isSoftDecline(code: string): boolean {\n return getDeclineCategory(code) === 'SOFT_DECLINE';\n}\n\n/**\n * Extract localized message from a Stripe error object\n *\n * @param error - The Stripe error object (or any caught value)\n * @param locale - The locale to use (default: 'en')\n * @returns User-facing message in the specified locale, or undefined if not found\n *\n * @example\n * ```ts\n * const stripeError = {\n * type: 'StripeCardError',\n * decline_code: 'insufficient_funds',\n * message: 'Your card has insufficient funds.'\n * };\n * const message = getMessageFromStripeError(stripeError, 'ja');\n * console.log(message);\n * // => \"ๅฅใฎใๆฏๆใๆนๆณใไฝฟ็จใใฆใใไธๅบฆใ่ฉฆใใใ ใใใ\"\n * ```\n */\nexport function getMessageFromStripeError(\n error: unknown,\n locale: Locale = 'en',\n): string | undefined {\n if (!isStripeDeclineError(error)) {\n return undefined;\n }\n\n return getDeclineMessage(error.decline_code, locale);\n}\n\n/**\n * Type guard that narrows an unknown error to one carrying a known Stripe decline code\n *\n * Returns true when `error` is an object whose `decline_code` is a valid\n * {@link DeclineCode}. Designed for `catch` blocks: a `StripeCardError` from\n * stripe-node >= 18 (where `decline_code` is a required `string`) narrows\n * straight to {@link StripeDeclineError}; errors from stripe-node <= 17 or\n * plain objects fall back through the same runtime check.\n *\n * @param error - The value to check (e.g. a caught Stripe error)\n * @returns True if the error carries a known decline code\n *\n * @example\n * ```ts\n * try {\n * await stripe.charges.create({ ... });\n * } catch (err) {\n * if (isStripeDeclineError(err)) {\n * // err.decline_code is typed as DeclineCode here\n * console.log(getDeclineMessage(err.decline_code, 'ja'));\n * }\n * }\n * ```\n */\nexport function isStripeDeclineError(error: unknown): error is StripeDeclineError {\n return (\n typeof error === 'object' &&\n error !== null &&\n 'decline_code' in error &&\n typeof (error as StripeError).decline_code === 'string' &&\n isValidDeclineCode((error as StripeDeclineError).decline_code)\n );\n}\n\n/**\n * Extract a validated decline code from a Stripe error object\n *\n * Unlike `getMessageFromStripeError`, this returns the decline code itself\n * (typed as {@link DeclineCode}) so it can be passed to any other helper in\n * this library. Accepts `unknown` so caught errors can be passed directly.\n *\n * @param error - The Stripe error object (or any caught value)\n * @returns The decline code, or undefined if absent or unknown\n *\n * @example\n * ```ts\n * try {\n * await stripe.charges.create({ ... });\n * } catch (err) {\n * const code = getDeclineCodeFromError(err);\n * if (code && isSoftDecline(code)) {\n * // safe to retry\n * }\n * }\n * ```\n */\nexport function getDeclineCodeFromError(error: unknown): DeclineCode | undefined {\n return isStripeDeclineError(error) ? error.decline_code : undefined;\n}\n\n// Export data for advanced use cases\nexport { DECLINE_CODES, DOC_VERSION } from './data/decline-codes.js';\n// Export types\nexport type {\n DeclineCategory,\n DeclineCode,\n DeclineCodeInfo,\n DeclineCodeResult,\n Locale,\n StripeDeclineError,\n StripeError,\n Translation,\n} from './types.js';\n"],"names":["DOC_VERSION","DECLINE_CODES","getDeclineDescription","declineCode","isValidDeclineCode","code","getDeclineMessage","locale","codeInfo","getAllDeclineCodes","getDocVersion","formatDeclineMessage","variables","baseMessage","formattedMessage","key","value","escapedKey","placeholder","getDeclineCategory","isHardDecline","isSoftDecline","getMessageFromStripeError","error","isStripeDeclineError","getDeclineCodeFromError"],"mappings":"AAOO,MAAMA,IAAc,cAMdC,IAAsD;AAAA,EACjE,iBAAiB;AAAA,IACf,aAAa;AAAA,IACb,WACE;AAAA,IACF,gBACE;AAAA,IACF,UAAU;AAAA,IACV,cAAc;AAAA,MACZ,IAAI;AAAA,QACF,aAAa;AAAA,QACb,gBACE;AAAA,MAAA;AAAA,IACJ;AAAA,EACF;AAAA,EAEF,aAAa;AAAA,IACX,aAAa;AAAA,IACb,WAAW;AAAA,IACX,gBAAgB;AAAA,IAChB,UAAU;AAAA,IACV,cAAc;AAAA,MACZ,IAAI;AAAA,QACF,aAAa;AAAA,QACb,gBAAgB;AAAA,MAAA;AAAA,IAClB;AAAA,EACF;AAAA,EAEF,oBAAoB;AAAA,IAClB,aAAa;AAAA,IACb,WACE;AAAA,IACF,gBACE;AAAA,IACF,UAAU;AAAA,IACV,cAAc;AAAA,MACZ,IAAI;AAAA,QACF,aAAa;AAAA,QACb,gBACE;AAAA,MAAA;AAAA,IACJ;AAAA,EACF;AAAA,EAEF,wBAAwB;AAAA,IACtB,aAAa;AAAA,IACb,WAAW;AAAA,IACX,gBAAgB;AAAA,IAChB,UAAU;AAAA,IACV,cAAc;AAAA,MACZ,IAAI;AAAA,QACF,aAAa;AAAA,QACb,gBAAgB;AAAA,MAAA;AAAA,IAClB;AAAA,EACF;AAAA,EAEF,wBAAwB;AAAA,IACtB,aAAa;AAAA,IACb,WACE;AAAA,IACF,gBACE;AAAA,IACF,UAAU;AAAA,IACV,cAAc;AAAA,MACZ,IAAI;AAAA,QACF,aAAa;AAAA,QACb,gBACE;AAAA,MAAA;AAAA,IACJ;AAAA,EACF;AAAA,EAEF,cAAc;AAAA,IACZ,aAAa;AAAA,IACb,WAAW;AAAA,IACX,gBA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,EAAmBd,CAAI,MAAM;AACtC;AAqBO,SAASiB,EACdC,GACAhB,IAAiB,MACG;AACpB,MAAKiB,EAAqBD,CAAK;AAI/B,WAAOjB,EAAkBiB,EAAM,cAAchB,CAAM;AACrD;AA0BO,SAASiB,EAAqBD,GAA6C;AAChF,SACE,OAAOA,KAAU,YACjBA,MAAU,QACV,kBAAkBA,KAClB,OAAQA,EAAsB,gBAAiB,YAC/CnB,EAAoBmB,EAA6B,YAAY;AAEjE;AAwBO,SAASE,EAAwBF,GAAyC;AAC/E,SAAOC,EAAqBD,CAAK,IAAIA,EAAM,eAAe;AAC5D;"}
|
package/dist/types.d.ts
CHANGED
|
@@ -46,6 +46,17 @@ export interface StripeError {
|
|
|
46
46
|
message?: string;
|
|
47
47
|
[key: string]: unknown;
|
|
48
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* A Stripe error known to carry a valid decline code.
|
|
51
|
+
*
|
|
52
|
+
* Matches the stripe-node >= 18 `StripeCardError` shape, where `decline_code`
|
|
53
|
+
* is a required string, narrowed further to the {@link DeclineCode} union.
|
|
54
|
+
* Errors from stripe-node <= 17 (where `decline_code` is optional) or plain
|
|
55
|
+
* objects can be narrowed to this type with `isStripeDeclineError`.
|
|
56
|
+
*/
|
|
57
|
+
export interface StripeDeclineError extends StripeError {
|
|
58
|
+
decline_code: DeclineCode;
|
|
59
|
+
}
|
|
49
60
|
/**
|
|
50
61
|
* All supported Stripe decline codes
|
|
51
62
|
*/
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;AAEjC;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,cAAc,GAAG,cAAc,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,MAAM,CAAC;IACp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AACH,MAAM,MAAM,WAAW,GACnB,iBAAiB,GACjB,aAAa,GACb,oBAAoB,GACpB,wBAAwB,GACxB,wBAAwB,GACxB,cAAc,GACd,kBAAkB,GAClB,uBAAuB,GACvB,cAAc,GACd,YAAY,GACZ,iBAAiB,GACjB,kBAAkB,GAClB,eAAe,GACf,eAAe,GACf,eAAe,GACf,oBAAoB,GACpB,iBAAiB,GACjB,gBAAgB,GAChB,aAAa,GACb,qBAAqB,GACrB,gBAAgB,GAChB,aAAa,GACb,sBAAsB,GACtB,WAAW,GACX,oBAAoB,GACpB,mCAAmC,GACnC,iBAAiB,GACjB,eAAe,GACf,aAAa,GACb,kBAAkB,GAClB,kBAAkB,GAClB,qBAAqB,GACrB,iBAAiB,GACjB,kCAAkC,GAClC,6BAA6B,GAC7B,oBAAoB,GACpB,qBAAqB,GACrB,aAAa,GACb,oBAAoB,GACpB,kBAAkB,GAClB,yBAAyB,GACzB,iBAAiB,GACjB,iCAAiC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stripe-decline-codes",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Complete database of Stripe decline codes with descriptions and localized messages",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -28,15 +28,17 @@
|
|
|
28
28
|
"build": "vite build && tsc -p tsconfig.build.json",
|
|
29
29
|
"test": "vitest run",
|
|
30
30
|
"test:watch": "vitest",
|
|
31
|
+
"test:workers": "vitest run --config vitest.workers.config.ts",
|
|
31
32
|
"test:coverage": "vitest run --coverage",
|
|
32
33
|
"lint": "biome check .",
|
|
33
34
|
"lint:fix": "biome check --write .",
|
|
34
35
|
"format": "biome format --write .",
|
|
35
|
-
"typecheck": "tsc --noEmit",
|
|
36
|
+
"typecheck": "tsc --noEmit && tsc -p tests/workers/tsconfig.json",
|
|
36
37
|
"prepublishOnly": "npm run lint && npm run typecheck && npm run test && npm run build",
|
|
37
38
|
"docs:generate": "tsx scripts/generate-docs.ts",
|
|
38
39
|
"docs:api": "typedoc",
|
|
39
|
-
"docs": "npm run docs:generate && npm run docs:api"
|
|
40
|
+
"docs": "npm run docs:generate && npm run docs:api",
|
|
41
|
+
"prepare": "husky"
|
|
40
42
|
},
|
|
41
43
|
"repository": {
|
|
42
44
|
"type": "git",
|
|
@@ -62,13 +64,19 @@
|
|
|
62
64
|
},
|
|
63
65
|
"devDependencies": {
|
|
64
66
|
"@biomejs/biome": "^2.3.6",
|
|
67
|
+
"@cloudflare/vitest-plugin": "^1.3.6",
|
|
68
|
+
"@commitlint/cli": "^21.2.3",
|
|
69
|
+
"@commitlint/config-conventional": "^21.2.3",
|
|
65
70
|
"@types/node": "^24.10.1",
|
|
71
|
+
"@vitest/runner": "^4.1.11",
|
|
72
|
+
"@vitest/snapshot": "^4.1.11",
|
|
66
73
|
"fast-check": "^4.5.2",
|
|
74
|
+
"husky": "^9.1.7",
|
|
67
75
|
"tsx": "^4.19.0",
|
|
68
76
|
"typedoc": "^0.28.20",
|
|
69
77
|
"typescript": "^5.9.3",
|
|
70
78
|
"vite": "^7.2.2",
|
|
71
|
-
"vitest": "^4.0
|
|
79
|
+
"vitest": "^4.1.0"
|
|
72
80
|
},
|
|
73
81
|
"packageManager": "pnpm@10.34.5",
|
|
74
82
|
"publishConfig": {
|