stripe-decline-codes 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018-2026 Hidetaka Okamoto
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -9,13 +9,15 @@ A lightweight, zero-dependency TypeScript library providing human-readable descr
9
9
 
10
10
  ## Features
11
11
 
12
- - ๐ŸŽฏ **Complete Coverage** - All 44 Stripe decline codes included
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
16
16
  - ๐Ÿ”„ **Up-to-date** - Based on Stripe API documentation (2024-12-18)
17
17
  - โœ… **Well Tested** - Comprehensive test coverage
18
18
  - ๐ŸŽจ **Message Formatting** - Customizable message templates with variable substitution
19
+ - ๐Ÿ” **Decline Categorization** - Soft/Hard decline classification based on Stripe guidelines
20
+ - โšก **Stripe SDK Integration** - Direct error object support for seamless integration
19
21
 
20
22
  ## About This Project
21
23
 
@@ -87,7 +89,7 @@ isValidDeclineCode('invalid_code'); // => false
87
89
  import { getAllDeclineCodes } from 'stripe-decline-codes';
88
90
 
89
91
  const codes = getAllDeclineCodes();
90
- console.log(codes.length); // => 44
92
+ console.log(codes.length); // => 43
91
93
  console.log(codes);
92
94
  // => ['approve_with_id', 'call_issuer', 'card_not_supported', ...]
93
95
  ```
@@ -108,16 +110,100 @@ try {
108
110
  currency: 'usd',
109
111
  source: 'tok_chargeDeclined',
110
112
  });
111
- } catch (error) {
112
- if (error.type === 'StripeCardError') {
113
- const declineCode = error.decline_code;
114
- const userMessage = getDeclineMessage(declineCode, 'en');
113
+ } catch (err) {
114
+ const error = err as Stripe.StripeCardError;
115
+ if (error.type === 'card_error' && error.decline_code) {
116
+ const userMessage = getDeclineMessage(error.decline_code, 'en');
115
117
  console.log(userMessage);
116
118
  // Display this message to your user
117
119
  }
118
120
  }
119
121
  ```
120
122
 
123
+ ### Decline Code Categorization
124
+
125
+ Understand whether a decline is temporary (soft) or permanent (hard):
126
+
127
+ ```typescript
128
+ import { getDeclineCategory, isSoftDecline, isHardDecline } from 'stripe-decline-codes';
129
+
130
+ // Get the category
131
+ const category = getDeclineCategory('insufficient_funds');
132
+ console.log(category); // => 'SOFT_DECLINE'
133
+
134
+ // Check if it's a soft decline (temporary, can retry)
135
+ if (isSoftDecline('insufficient_funds')) {
136
+ console.log('This is a temporary issue, you can retry the payment');
137
+ }
138
+
139
+ // Check if it's a hard decline (permanent, should not retry)
140
+ if (isHardDecline('fraudulent')) {
141
+ console.log('This is a permanent decline, do not retry');
142
+ }
143
+ ```
144
+
145
+ ### Extract Message from Stripe Error
146
+
147
+ Directly extract user-facing messages from Stripe error objects:
148
+
149
+ ```typescript
150
+ import Stripe from 'stripe';
151
+ import { getMessageFromStripeError, isHardDecline } from 'stripe-decline-codes';
152
+
153
+ const stripe = new Stripe(process.env.STRIPE_SECRET_KEY);
154
+
155
+ try {
156
+ const charge = await stripe.charges.create({
157
+ amount: 2000,
158
+ currency: 'usd',
159
+ source: 'tok_chargeDeclined',
160
+ });
161
+ } catch (err) {
162
+ const error = err as Stripe.StripeCardError;
163
+ if (error.type === 'card_error' && error.decline_code) {
164
+ // Get localized message directly from error object
165
+ const userMessage = getMessageFromStripeError(error, 'ja');
166
+
167
+ // Check if retry is recommended
168
+ if (isHardDecline(error.decline_code)) {
169
+ // Ask for a different payment method
170
+ console.log('Please use a different card');
171
+ } else {
172
+ // Retry is possible
173
+ console.log('You may retry this payment');
174
+ }
175
+ }
176
+ }
177
+ ```
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
+
121
207
  ## API Reference
122
208
 
123
209
  ### Core Functions
@@ -180,9 +266,56 @@ const message = formatDeclineMessage('insufficient_funds', 'en', {
180
266
  });
181
267
  ```
182
268
 
269
+ ### Decline Categorization Functions
270
+
271
+ #### `getDeclineCategory(code: string): DeclineCategory | undefined`
272
+
273
+ Returns the category of a decline code ('SOFT_DECLINE' or 'HARD_DECLINE').
274
+
275
+ **Parameters:**
276
+ - `code` - The Stripe decline code
277
+
278
+ **Returns:** `'SOFT_DECLINE' | 'HARD_DECLINE' | undefined`
279
+
280
+ #### `isHardDecline(code: string): boolean`
281
+
282
+ Checks if a decline code is a hard decline (permanent, should not retry).
283
+
284
+ **Returns:** `true` if the code is a hard decline, `false` otherwise
285
+
286
+ #### `isSoftDecline(code: string): boolean`
287
+
288
+ Checks if a decline code is a soft decline (temporary, can retry).
289
+
290
+ **Returns:** `true` if the code is a soft decline, `false` otherwise
291
+
292
+ ### Stripe Error Integration
293
+
294
+ #### `getMessageFromStripeError(error: unknown, locale?: Locale): string | undefined`
295
+
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.
297
+
298
+ **Parameters:**
299
+ - `error` - The Stripe error object (or any caught value)
300
+ - `locale` - The locale to use (`'en'` or `'ja'`, default: `'en'`)
301
+
302
+ **Returns:** User-facing message in the specified locale, or undefined if no decline code is present
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
+
183
316
  ## Supported Decline Codes
184
317
 
185
- This library includes all 44 Stripe decline codes:
318
+ This library includes all 43 Stripe decline codes:
186
319
 
187
320
  - `approve_with_id` - Payment cannot be authorized
188
321
  - `call_issuer` - Card declined for unknown reason
@@ -228,6 +361,29 @@ This library includes all 44 Stripe decline codes:
228
361
  - `try_again_later` - Card declined, try again later
229
362
  - `withdrawal_count_limit_exceeded` - Credit limit exceeded
230
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
+
231
387
  ## TypeScript
232
388
 
233
389
  This library is written in TypeScript and includes full type definitions:
@@ -239,41 +395,54 @@ import type {
239
395
  DeclineCodeResult,
240
396
  Locale,
241
397
  Translation,
398
+ DeclineCategory,
399
+ StripeError,
400
+ StripeDeclineError,
242
401
  } from 'stripe-decline-codes';
243
402
  ```
244
403
 
245
404
  ## Development
246
405
 
406
+ This project uses [pnpm](https://pnpm.io/) (`packageManager` is pinned in `package.json`).
407
+
247
408
  ```bash
248
409
  # Install dependencies
249
- npm install
410
+ pnpm install
250
411
 
251
412
  # Run tests
252
- npm test
413
+ pnpm test
253
414
 
254
415
  # Run tests in watch mode
255
- npm run test:watch
416
+ pnpm run test:watch
256
417
 
257
418
  # Build
258
- npm run build
419
+ pnpm run build
259
420
 
260
421
  # Lint
261
- npm run lint
422
+ pnpm run lint
262
423
 
263
424
  # Format code
264
- npm run format
425
+ pnpm run format
265
426
 
266
427
  # Type check
267
- npm run typecheck
428
+ pnpm run typecheck
268
429
  ```
269
430
 
270
- ## Publishing
431
+ The `docs/` directory is a separate npm project (Starlight site) and keeps using `npm`.
271
432
 
272
- This package uses [`np`](https://github.com/sindresorhus/np) for releases:
433
+ ## Publishing
273
434
 
274
- ```bash
275
- npm run release
276
- ```
435
+ Releases are automated by CircleCI. Merge a PR whose commits follow
436
+ [Conventional Commits](https://www.conventionalcommits.org/) (`feat:`, `fix:`, โ€ฆ)
437
+ into `main`, and [semantic-release](https://github.com/semantic-release/semantic-release)
438
+ pushes the git tag, publishes to npm via Trusted Publishing (OIDC), and creates the
439
+ GitHub Release. Release notes are published on
440
+ [GitHub Releases](https://github.com/hideokamoto/stripe-decline-codes/releases).
441
+ Do not bump `version`, create tags, or run `npm publish` / `np` manually.
442
+
443
+ The pipeline definition is shared via
444
+ [`circleci-configurations`](https://github.com/hideokamoto/circleci-configurations)
445
+ (`workflows/publish/npm-polyrepo-semantic-release.yaml`).
277
446
 
278
447
  ## Contributing
279
448
 
@@ -0,0 +1,13 @@
1
+ import type { DeclineCode, DeclineCodeInfo } from '../types.js';
2
+ /**
3
+ * Stripe API documentation version for decline codes
4
+ * Last updated: 2024-12
5
+ * Reference: https://docs.stripe.com/declines/codes
6
+ */
7
+ export declare const DOC_VERSION = "2024-12-18";
8
+ /**
9
+ * Complete database of Stripe decline codes with descriptions and recommended actions
10
+ * Includes English and Japanese translations
11
+ */
12
+ export declare const DECLINE_CODES: Record<DeclineCode, DeclineCodeInfo>;
13
+ //# sourceMappingURL=decline-codes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decline-codes.d.ts","sourceRoot":"","sources":["../../src/data/decline-codes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEhE;;;;GAIG;AACH,eAAO,MAAM,WAAW,eAAe,CAAC;AAExC;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,WAAW,EAAE,eAAe,CA8iB9D,CAAC"}
package/dist/index.cjs ADDED
@@ -0,0 +1,2 @@
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
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +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 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,sEACX,eAAgB,wDAChB,SAAU,eACV,aAAc,CACZ,GAAI,CACF,YAAa,4BACb,eAAgB,yBAAA,CAClB,CACF,EAEF,uBAAwB,CACtB,YAAa,oDACb,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