@nymbalhq/payments-stripe 1.5.0 → 1.6.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 +21 -0
- package/README.md +10 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.js +21 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 nymbal contributors
|
|
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
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# @nymbalhq/payments-stripe
|
|
2
|
+
|
|
3
|
+
Stripe payments for Nymbal: the `stripe` payments provider.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npx nymbal add stripe
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
`nymbal add` installs it, sets it in `nymbal.config.ts` and lists the variables it needs in `.env.example`.
|
|
10
|
+
See [Adapters](https://github.com/nymbalhq/nymbal/blob/main/apps/docs/src/content/docs/adapters.md).
|
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,11 @@ interface StripePaymentsConfig {
|
|
|
13
13
|
/** Override the Stripe API protocol. Defaults to https when omitted. */
|
|
14
14
|
protocol?: 'http' | 'https';
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* The Stripe API version a Shared Payment Token is charged under: SPTs exist only in preview versions, so this call
|
|
18
|
+
* alone sends it, and every other call keeps the client's version.
|
|
19
|
+
*/
|
|
20
|
+
declare const STRIPE_SPT_API_VERSION = "2026-10-28.preview";
|
|
16
21
|
declare function createStripePaymentsAdapter(deps: {
|
|
17
22
|
logger: Logger;
|
|
18
23
|
config: StripePaymentsConfig;
|
|
@@ -27,5 +32,5 @@ declare const settings: AdapterSetting[];
|
|
|
27
32
|
/** The kernel's entry: `payments: { provider: 'stripe', config: StripePaymentsConfig }`. */
|
|
28
33
|
declare function createAdapter(ctx: AdapterContext): PaymentsAdapter;
|
|
29
34
|
|
|
30
|
-
export { createAdapter, createStripePaymentsAdapter, provider, settings, slot };
|
|
35
|
+
export { STRIPE_SPT_API_VERSION, createAdapter, createStripePaymentsAdapter, provider, settings, slot };
|
|
31
36
|
export type { StripePaymentsConfig };
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,12 @@ import {
|
|
|
11
11
|
EVT_PAYMENT_REFUNDED,
|
|
12
12
|
PaymentError
|
|
13
13
|
} from "@nymbalhq/types";
|
|
14
|
+
var STRIPE_SPT_API_VERSION = "2026-10-28.preview";
|
|
15
|
+
function delegatedPaymentMethod(token) {
|
|
16
|
+
return {
|
|
17
|
+
shared_payment_granted_token: token
|
|
18
|
+
};
|
|
19
|
+
}
|
|
14
20
|
function toIsoCurrency(currency) {
|
|
15
21
|
return currency.toUpperCase();
|
|
16
22
|
}
|
|
@@ -69,7 +75,7 @@ function createStripePaymentsAdapter(deps) {
|
|
|
69
75
|
return {
|
|
70
76
|
kind: "payments",
|
|
71
77
|
providerName: "stripe",
|
|
72
|
-
capabilities: () => ["intent", "capture", "refund", "webhook"],
|
|
78
|
+
capabilities: () => ["intent", "capture", "refund", "webhook", "delegated"],
|
|
73
79
|
// Without a key the storefront's stripe driver reports it cannot mount, which keeps Place Order disabled.
|
|
74
80
|
client: () => ({
|
|
75
81
|
driver: "stripe",
|
|
@@ -92,7 +98,7 @@ function createStripePaymentsAdapter(deps) {
|
|
|
92
98
|
},
|
|
93
99
|
async createPaymentIntent(params) {
|
|
94
100
|
try {
|
|
95
|
-
const
|
|
101
|
+
const create = {
|
|
96
102
|
amount: params.amountMinor,
|
|
97
103
|
currency: params.currency.toLowerCase(),
|
|
98
104
|
automatic_payment_methods: { enabled: true },
|
|
@@ -102,7 +108,18 @@ function createStripePaymentsAdapter(deps) {
|
|
|
102
108
|
...params.orderRef !== void 0 ? { orderRef: params.orderRef } : {},
|
|
103
109
|
...params.customerId !== void 0 ? { customerId: params.customerId } : {}
|
|
104
110
|
}
|
|
105
|
-
}
|
|
111
|
+
};
|
|
112
|
+
const token = params.delegatedToken;
|
|
113
|
+
if (token === void 0) return toIntent(await stripeClient.paymentIntents.create(create));
|
|
114
|
+
const intent = await stripeClient.paymentIntents.create(
|
|
115
|
+
{
|
|
116
|
+
...create,
|
|
117
|
+
confirm: true,
|
|
118
|
+
payment_method_data: delegatedPaymentMethod(token),
|
|
119
|
+
automatic_payment_methods: { enabled: true, allow_redirects: "never" }
|
|
120
|
+
},
|
|
121
|
+
{ apiVersion: STRIPE_SPT_API_VERSION }
|
|
122
|
+
);
|
|
106
123
|
return toIntent(intent);
|
|
107
124
|
} catch (err) {
|
|
108
125
|
throw new PaymentError("intent_failed", "Stripe createPaymentIntent failed", { cause: err });
|
|
@@ -251,6 +268,7 @@ function createAdapter(ctx) {
|
|
|
251
268
|
});
|
|
252
269
|
}
|
|
253
270
|
export {
|
|
271
|
+
STRIPE_SPT_API_VERSION,
|
|
254
272
|
createAdapter,
|
|
255
273
|
createStripePaymentsAdapter,
|
|
256
274
|
provider,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/stripe-adapter.ts"],"sourcesContent":["import {\n ConfigError,\n type AdapterContext,\n type AdapterSetting,\n type PaymentsAdapter,\n} from '@nymbalhq/types'\nimport { createStripePaymentsAdapter, type StripePaymentsConfig } from './stripe-adapter.js'\n\n/** What this package serves: the kernel refuses it on any other slot or provider. */\nexport const slot = 'payments'\nexport const provider = 'stripe'\n\nexport { createStripePaymentsAdapter, type StripePaymentsConfig }\n\n/** The fields the admin's Settings may fill when the config and these variables leave them unset. */\nexport const settings: AdapterSetting[] = [\n { path: 'secretKey', label: 'Secret key', secret: true, env: 'STRIPE_SECRET_KEY' },\n {\n path: 'webhookSecret',\n label: 'Webhook signing secret',\n secret: true,\n env: 'STRIPE_WEBHOOK_SECRET',\n },\n {\n path: 'publishableKey',\n label: 'Publishable key',\n secret: false,\n env: 'STRIPE_PUBLISHABLE_KEY',\n },\n]\n\n/** The kernel's entry: `payments: { provider: 'stripe', config: StripePaymentsConfig }`. */\nexport function createAdapter(ctx: AdapterContext): PaymentsAdapter {\n if (ctx.slot !== 'payments') {\n throw new ConfigError(`@nymbalhq/payments-stripe serves payments, not ${ctx.slot}`, {\n code: 'adapter.wrong_slot',\n context: { slot: ctx.slot },\n })\n }\n const config = ctx.config as unknown as StripePaymentsConfig\n const publishableKey = config.publishableKey ?? ctx.env['STRIPE_PUBLISHABLE_KEY']\n return createStripePaymentsAdapter({\n logger: ctx.logger,\n config: { ...config, ...(publishableKey !== undefined && { publishableKey }) },\n })\n}\n","import Stripe from 'stripe'\nimport {\n EVT_PAYMENT_CAPTURED,\n EVT_PAYMENT_FAILED,\n EVT_PAYMENT_REFUNDED,\n PaymentError,\n type Logger,\n type PaymentCapture,\n type PaymentIntent,\n type PaymentIntentParams,\n type PaymentStatus,\n type PaymentsAdapter,\n type Refund,\n type WebhookResult,\n} from '@nymbalhq/types'\n\nexport interface StripePaymentsConfig {\n secretKey: string\n webhookSecret: string\n /** The public key the storefront's Stripe.js uses; served by GET /api/capabilities. */\n publishableKey?: string\n apiVersion?: string\n /** Override the Stripe API host (for stripe-mock style test servers). Omit in production. */\n host?: string\n /** Override the Stripe API port. Only used together with `host`. */\n port?: number\n /** Override the Stripe API protocol. Defaults to https when omitted. */\n protocol?: 'http' | 'https'\n}\n\n/**\n * Stripe returns lowercase ISO currency codes (e.g. \"gbp\"); Nymbal's canonical\n * currency format is uppercase ISO 4217 (e.g. \"GBP\") everywhere else in the\n * domain, so adapter results are normalised on the way out.\n */\nfunction toIsoCurrency(currency: string): string {\n return currency.toUpperCase()\n}\n\nfunction mapStatus(status: Stripe.PaymentIntent.Status): PaymentStatus {\n switch (status) {\n case 'requires_payment_method':\n case 'requires_confirmation':\n case 'requires_action':\n case 'processing':\n case 'requires_capture':\n case 'succeeded':\n case 'canceled':\n return status === 'canceled' ? 'cancelled' : (status as PaymentStatus)\n default:\n return 'failed'\n }\n}\n\nfunction refundStatus(status: string | null): Refund['status'] {\n if (status === 'succeeded') return 'succeeded'\n if (status === 'failed' || status === 'canceled') return 'failed'\n return 'pending'\n}\n\n/**\n * Stripe refused the refund outright (a card error, an invalid request): no money moved. Anything else (an API error,\n * a timeout, a dropped connection) leaves the outcome unknown.\n */\nfunction isDefiniteRefusal(err: unknown): boolean {\n const e = err as { rawType?: unknown; statusCode?: unknown } | null\n // A refused key (401, 403) says nothing about the refund, though its body's type is invalid_request_error: the\n // status decides first, as it does in stripe-node.\n if (e?.statusCode === 401 || e?.statusCode === 403) return false\n // The API's error type (`raw.type`), which does not depend on the SDK's class names.\n return e?.rawType === 'card_error' || e?.rawType === 'invalid_request_error'\n}\n\nfunction toIntent(intent: Stripe.PaymentIntent): PaymentIntent {\n return {\n id: intent.id,\n clientSecret: intent.client_secret ?? '',\n amountMinor: intent.amount,\n currency: toIsoCurrency(intent.currency),\n status: mapStatus(intent.status),\n }\n}\n\nexport function createStripePaymentsAdapter(deps: {\n logger: Logger\n config: StripePaymentsConfig\n}): PaymentsAdapter {\n const { logger } = deps\n const cfg = deps.config\n if (!cfg.secretKey) throw new PaymentError('not_configured', 'Stripe secretKey missing')\n if (!cfg.webhookSecret) throw new PaymentError('not_configured', 'Stripe webhookSecret missing')\n // The publishable key is served to every shopper: a secret or restricted key pasted there must never be.\n if (cfg.publishableKey !== undefined && /^(sk|rk)_/.test(cfg.publishableKey)) {\n throw new PaymentError(\n 'not_configured',\n 'Stripe publishableKey holds a secret key; use the pk_ key',\n )\n }\n const stripeClient = new Stripe(cfg.secretKey, {\n ...(cfg.apiVersion !== undefined && {\n apiVersion: cfg.apiVersion as Stripe.LatestApiVersion,\n }),\n ...(cfg.host !== undefined && { host: cfg.host }),\n ...(cfg.port !== undefined && { port: cfg.port }),\n ...(cfg.protocol !== undefined && { protocol: cfg.protocol }),\n })\n return {\n kind: 'payments',\n providerName: 'stripe',\n capabilities: () => ['intent', 'capture', 'refund', 'webhook'],\n // Without a key the storefront's stripe driver reports it cannot mount, which keeps Place Order disabled.\n client: () => ({\n driver: 'stripe',\n options: cfg.publishableKey ? { publishableKey: cfg.publishableKey } : {},\n }),\n producesEvents: [EVT_PAYMENT_CAPTURED, EVT_PAYMENT_FAILED, EVT_PAYMENT_REFUNDED],\n consumesEvents: [],\n async initialize() {\n // no-op: Stripe client already constructed\n },\n async healthCheck() {\n try {\n await stripeClient.balance.retrieve()\n return { status: 'healthy' }\n } catch (err) {\n return {\n status: 'down',\n detail: err instanceof Error ? err.message : String(err),\n }\n }\n },\n async createPaymentIntent(params: PaymentIntentParams): Promise<PaymentIntent> {\n try {\n const intent = await stripeClient.paymentIntents.create({\n amount: params.amountMinor,\n currency: params.currency.toLowerCase(),\n automatic_payment_methods: { enabled: true },\n ...(params.receiptEmail !== undefined && { receipt_email: params.receiptEmail }),\n metadata: {\n ...(params.metadata ?? {}),\n ...(params.orderRef !== undefined ? { orderRef: params.orderRef } : {}),\n ...(params.customerId !== undefined ? { customerId: params.customerId } : {}),\n },\n })\n return toIntent(intent)\n } catch (err) {\n throw new PaymentError('intent_failed', 'Stripe createPaymentIntent failed', { cause: err })\n }\n },\n async capturePayment(intentId, amountMinor): Promise<PaymentCapture> {\n try {\n const captured = await stripeClient.paymentIntents.capture(intentId, {\n ...(amountMinor !== undefined && { amount_to_capture: amountMinor }),\n })\n return {\n paymentId: captured.id,\n capturedAmountMinor: captured.amount_received ?? captured.amount,\n currency: toIsoCurrency(captured.currency),\n status: mapStatus(captured.status),\n }\n } catch (err) {\n throw new PaymentError('capture_failed', 'Stripe capturePayment failed', { cause: err })\n }\n },\n async refund(paymentId, amountMinor, reason, opts): Promise<Refund> {\n const params: Stripe.RefundCreateParams = {\n payment_intent: paymentId,\n ...(amountMinor !== undefined && { amount: amountMinor }),\n ...(reason !== undefined && { reason: reason as Stripe.RefundCreateParams.Reason }),\n }\n try {\n const refund =\n opts?.idempotencyKey === undefined\n ? await stripeClient.refunds.create(params)\n : await stripeClient.refunds.create(params, { idempotencyKey: opts.idempotencyKey })\n return {\n refundId: refund.id,\n paymentId,\n amountMinor: refund.amount,\n currency: toIsoCurrency(refund.currency),\n reason: refund.reason ?? null,\n status: refundStatus(refund.status),\n }\n } catch (err) {\n if (isDefiniteRefusal(err)) {\n throw new PaymentError('refund_rejected', 'Stripe refused the refund', { cause: err })\n }\n throw new PaymentError('refund_unknown', 'Stripe refund outcome unknown', { cause: err })\n }\n },\n async getPaymentStatus(intentId): Promise<PaymentStatus> {\n const intent = await stripeClient.paymentIntents.retrieve(intentId)\n return mapStatus(intent.status)\n },\n async getPaymentIntent(intentId): Promise<PaymentIntent> {\n try {\n return toIntent(await stripeClient.paymentIntents.retrieve(intentId))\n } catch (err) {\n throw new PaymentError('intent_failed', 'Stripe getPaymentIntent failed', { cause: err })\n }\n },\n async cancelPaymentIntent(intentId): Promise<void> {\n try {\n await stripeClient.paymentIntents.cancel(intentId)\n } catch (err) {\n // A cancel that lost a race with an earlier one of ours is done; anything else (processing, captured) stays.\n const status = await stripeClient.paymentIntents\n .retrieve(intentId)\n .then((intent) => intent.status)\n .catch(() => undefined)\n if (status === 'canceled') return\n throw new PaymentError('cancel_refused', `Stripe would not cancel ${intentId}`, {\n cause: err,\n })\n }\n },\n async parseWebhook(rawBody, signature): Promise<WebhookResult> {\n let event: Stripe.Event\n try {\n event = stripeClient.webhooks.constructEvent(rawBody, signature, cfg.webhookSecret)\n } catch (err) {\n throw new PaymentError('webhook_invalid', 'Stripe webhook signature invalid', {\n cause: err,\n })\n }\n const baseResult = { verified: true, eventId: event.id } as const\n switch (event.type) {\n case 'payment_intent.succeeded': {\n const intent = event.data.object as Stripe.PaymentIntent\n return {\n ...baseResult,\n kind: 'payment.captured',\n paymentIntentId: intent.id,\n amountMinor: intent.amount_received ?? intent.amount,\n currency: toIsoCurrency(intent.currency),\n raw: { ...intent } as unknown as Record<string, unknown>,\n }\n }\n case 'payment_intent.payment_failed': {\n const intent = event.data.object as Stripe.PaymentIntent\n return {\n ...baseResult,\n kind: 'payment.failed',\n paymentIntentId: intent.id,\n reason: intent.last_payment_error?.message ?? 'payment failed',\n }\n }\n case 'charge.refunded': {\n const charge = event.data.object as Stripe.Charge\n const pi =\n typeof charge.payment_intent === 'string'\n ? charge.payment_intent\n : charge.payment_intent?.id\n return {\n ...baseResult,\n kind: 'payment.refunded',\n ...(pi !== undefined && { paymentIntentId: pi }),\n amountMinor: charge.amount_refunded,\n currency: toIsoCurrency(charge.currency),\n }\n }\n default:\n logger.debug({ type: event.type }, 'stripe webhook ignored')\n return { ...baseResult, kind: 'ignored' }\n }\n },\n }\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,OAIK;;;ACLP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MAAI,IAAI,SAAS,YAAY;AAC3B,UAAM,IAAI,YAAY,kDAAkD,IAAI,IAAI,IAAI;AAAA,MAClF,MAAM;AAAA,MACN,SAAS,EAAE,MAAM,IAAI,KAAK;AAAA,IAC5B,CAAC;AAAA,EACH;AACA,QAAM,SAAS,IAAI;AACnB,QAAM,iBAAiB,OAAO,kBAAkB,IAAI,IAAI,wBAAwB;AAChF,SAAO,4BAA4B;AAAA,IACjC,QAAQ,IAAI;AAAA,IACZ,QAAQ,EAAE,GAAG,QAAQ,GAAI,mBAAmB,UAAa,EAAE,eAAe,EAAG;AAAA,EAC/E,CAAC;AACH;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/stripe-adapter.ts"],"sourcesContent":["import {\n ConfigError,\n type AdapterContext,\n type AdapterSetting,\n type PaymentsAdapter,\n} from '@nymbalhq/types'\nimport {\n createStripePaymentsAdapter,\n STRIPE_SPT_API_VERSION,\n type StripePaymentsConfig,\n} from './stripe-adapter.js'\n\n/** What this package serves: the kernel refuses it on any other slot or provider. */\nexport const slot = 'payments'\nexport const provider = 'stripe'\n\nexport { createStripePaymentsAdapter, STRIPE_SPT_API_VERSION, type StripePaymentsConfig }\n\n/** The fields the admin's Settings may fill when the config and these variables leave them unset. */\nexport const settings: AdapterSetting[] = [\n { path: 'secretKey', label: 'Secret key', secret: true, env: 'STRIPE_SECRET_KEY' },\n {\n path: 'webhookSecret',\n label: 'Webhook signing secret',\n secret: true,\n env: 'STRIPE_WEBHOOK_SECRET',\n },\n {\n path: 'publishableKey',\n label: 'Publishable key',\n secret: false,\n env: 'STRIPE_PUBLISHABLE_KEY',\n },\n]\n\n/** The kernel's entry: `payments: { provider: 'stripe', config: StripePaymentsConfig }`. */\nexport function createAdapter(ctx: AdapterContext): PaymentsAdapter {\n if (ctx.slot !== 'payments') {\n throw new ConfigError(`@nymbalhq/payments-stripe serves payments, not ${ctx.slot}`, {\n code: 'adapter.wrong_slot',\n context: { slot: ctx.slot },\n })\n }\n const config = ctx.config as unknown as StripePaymentsConfig\n const publishableKey = config.publishableKey ?? ctx.env['STRIPE_PUBLISHABLE_KEY']\n return createStripePaymentsAdapter({\n logger: ctx.logger,\n config: { ...config, ...(publishableKey !== undefined && { publishableKey }) },\n })\n}\n","import Stripe from 'stripe'\nimport {\n EVT_PAYMENT_CAPTURED,\n EVT_PAYMENT_FAILED,\n EVT_PAYMENT_REFUNDED,\n PaymentError,\n type Logger,\n type PaymentCapture,\n type PaymentIntent,\n type PaymentIntentParams,\n type PaymentStatus,\n type PaymentsAdapter,\n type Refund,\n type WebhookResult,\n} from '@nymbalhq/types'\n\nexport interface StripePaymentsConfig {\n secretKey: string\n webhookSecret: string\n /** The public key the storefront's Stripe.js uses; served by GET /api/capabilities. */\n publishableKey?: string\n apiVersion?: string\n /** Override the Stripe API host (for stripe-mock style test servers). Omit in production. */\n host?: string\n /** Override the Stripe API port. Only used together with `host`. */\n port?: number\n /** Override the Stripe API protocol. Defaults to https when omitted. */\n protocol?: 'http' | 'https'\n}\n\n/**\n * The Stripe API version a Shared Payment Token is charged under: SPTs exist only in preview versions, so this call\n * alone sends it, and every other call keeps the client's version.\n */\nexport const STRIPE_SPT_API_VERSION = '2026-10-28.preview'\n\n/**\n * stripe-node 17 predates SPTs: `payment_method_data` carrying only the token, which its type (requiring `type`) does\n * not describe.\n */\nfunction delegatedPaymentMethod(token: string): Stripe.PaymentIntentCreateParams.PaymentMethodData {\n return {\n shared_payment_granted_token: token,\n } as unknown as Stripe.PaymentIntentCreateParams.PaymentMethodData\n}\n\n/**\n * Stripe returns lowercase ISO currency codes (e.g. \"gbp\"); Nymbal's canonical\n * currency format is uppercase ISO 4217 (e.g. \"GBP\") everywhere else in the\n * domain, so adapter results are normalised on the way out.\n */\nfunction toIsoCurrency(currency: string): string {\n return currency.toUpperCase()\n}\n\nfunction mapStatus(status: Stripe.PaymentIntent.Status): PaymentStatus {\n switch (status) {\n case 'requires_payment_method':\n case 'requires_confirmation':\n case 'requires_action':\n case 'processing':\n case 'requires_capture':\n case 'succeeded':\n case 'canceled':\n return status === 'canceled' ? 'cancelled' : (status as PaymentStatus)\n default:\n return 'failed'\n }\n}\n\nfunction refundStatus(status: string | null): Refund['status'] {\n if (status === 'succeeded') return 'succeeded'\n if (status === 'failed' || status === 'canceled') return 'failed'\n return 'pending'\n}\n\n/**\n * Stripe refused the refund outright (a card error, an invalid request): no money moved. Anything else (an API error,\n * a timeout, a dropped connection) leaves the outcome unknown.\n */\nfunction isDefiniteRefusal(err: unknown): boolean {\n const e = err as { rawType?: unknown; statusCode?: unknown } | null\n // A refused key (401, 403) says nothing about the refund, though its body's type is invalid_request_error: the\n // status decides first, as it does in stripe-node.\n if (e?.statusCode === 401 || e?.statusCode === 403) return false\n // The API's error type (`raw.type`), which does not depend on the SDK's class names.\n return e?.rawType === 'card_error' || e?.rawType === 'invalid_request_error'\n}\n\nfunction toIntent(intent: Stripe.PaymentIntent): PaymentIntent {\n return {\n id: intent.id,\n clientSecret: intent.client_secret ?? '',\n amountMinor: intent.amount,\n currency: toIsoCurrency(intent.currency),\n status: mapStatus(intent.status),\n }\n}\n\nexport function createStripePaymentsAdapter(deps: {\n logger: Logger\n config: StripePaymentsConfig\n}): PaymentsAdapter {\n const { logger } = deps\n const cfg = deps.config\n if (!cfg.secretKey) throw new PaymentError('not_configured', 'Stripe secretKey missing')\n if (!cfg.webhookSecret) throw new PaymentError('not_configured', 'Stripe webhookSecret missing')\n // The publishable key is served to every shopper: a secret or restricted key pasted there must never be.\n if (cfg.publishableKey !== undefined && /^(sk|rk)_/.test(cfg.publishableKey)) {\n throw new PaymentError(\n 'not_configured',\n 'Stripe publishableKey holds a secret key; use the pk_ key',\n )\n }\n const stripeClient = new Stripe(cfg.secretKey, {\n ...(cfg.apiVersion !== undefined && {\n apiVersion: cfg.apiVersion as Stripe.LatestApiVersion,\n }),\n ...(cfg.host !== undefined && { host: cfg.host }),\n ...(cfg.port !== undefined && { port: cfg.port }),\n ...(cfg.protocol !== undefined && { protocol: cfg.protocol }),\n })\n return {\n kind: 'payments',\n providerName: 'stripe',\n capabilities: () => ['intent', 'capture', 'refund', 'webhook', 'delegated'],\n // Without a key the storefront's stripe driver reports it cannot mount, which keeps Place Order disabled.\n client: () => ({\n driver: 'stripe',\n options: cfg.publishableKey ? { publishableKey: cfg.publishableKey } : {},\n }),\n producesEvents: [EVT_PAYMENT_CAPTURED, EVT_PAYMENT_FAILED, EVT_PAYMENT_REFUNDED],\n consumesEvents: [],\n async initialize() {\n // no-op: Stripe client already constructed\n },\n async healthCheck() {\n try {\n await stripeClient.balance.retrieve()\n return { status: 'healthy' }\n } catch (err) {\n return {\n status: 'down',\n detail: err instanceof Error ? err.message : String(err),\n }\n }\n },\n async createPaymentIntent(params: PaymentIntentParams): Promise<PaymentIntent> {\n try {\n const create: Stripe.PaymentIntentCreateParams = {\n amount: params.amountMinor,\n currency: params.currency.toLowerCase(),\n automatic_payment_methods: { enabled: true },\n ...(params.receiptEmail !== undefined && { receipt_email: params.receiptEmail }),\n metadata: {\n ...(params.metadata ?? {}),\n ...(params.orderRef !== undefined ? { orderRef: params.orderRef } : {}),\n ...(params.customerId !== undefined ? { customerId: params.customerId } : {}),\n },\n }\n const token = params.delegatedToken\n if (token === undefined) return toIntent(await stripeClient.paymentIntents.create(create))\n // Confirmed server-side with no return_url, so a method that redirects the buyer cannot be offered.\n const intent = await stripeClient.paymentIntents.create(\n {\n ...create,\n confirm: true,\n payment_method_data: delegatedPaymentMethod(token),\n automatic_payment_methods: { enabled: true, allow_redirects: 'never' },\n },\n { apiVersion: STRIPE_SPT_API_VERSION },\n )\n return toIntent(intent)\n } catch (err) {\n throw new PaymentError('intent_failed', 'Stripe createPaymentIntent failed', { cause: err })\n }\n },\n async capturePayment(intentId, amountMinor): Promise<PaymentCapture> {\n try {\n const captured = await stripeClient.paymentIntents.capture(intentId, {\n ...(amountMinor !== undefined && { amount_to_capture: amountMinor }),\n })\n return {\n paymentId: captured.id,\n capturedAmountMinor: captured.amount_received ?? captured.amount,\n currency: toIsoCurrency(captured.currency),\n status: mapStatus(captured.status),\n }\n } catch (err) {\n throw new PaymentError('capture_failed', 'Stripe capturePayment failed', { cause: err })\n }\n },\n async refund(paymentId, amountMinor, reason, opts): Promise<Refund> {\n const params: Stripe.RefundCreateParams = {\n payment_intent: paymentId,\n ...(amountMinor !== undefined && { amount: amountMinor }),\n ...(reason !== undefined && { reason: reason as Stripe.RefundCreateParams.Reason }),\n }\n try {\n const refund =\n opts?.idempotencyKey === undefined\n ? await stripeClient.refunds.create(params)\n : await stripeClient.refunds.create(params, { idempotencyKey: opts.idempotencyKey })\n return {\n refundId: refund.id,\n paymentId,\n amountMinor: refund.amount,\n currency: toIsoCurrency(refund.currency),\n reason: refund.reason ?? null,\n status: refundStatus(refund.status),\n }\n } catch (err) {\n if (isDefiniteRefusal(err)) {\n throw new PaymentError('refund_rejected', 'Stripe refused the refund', { cause: err })\n }\n throw new PaymentError('refund_unknown', 'Stripe refund outcome unknown', { cause: err })\n }\n },\n async getPaymentStatus(intentId): Promise<PaymentStatus> {\n const intent = await stripeClient.paymentIntents.retrieve(intentId)\n return mapStatus(intent.status)\n },\n async getPaymentIntent(intentId): Promise<PaymentIntent> {\n try {\n return toIntent(await stripeClient.paymentIntents.retrieve(intentId))\n } catch (err) {\n throw new PaymentError('intent_failed', 'Stripe getPaymentIntent failed', { cause: err })\n }\n },\n async cancelPaymentIntent(intentId): Promise<void> {\n try {\n await stripeClient.paymentIntents.cancel(intentId)\n } catch (err) {\n // A cancel that lost a race with an earlier one of ours is done; anything else (processing, captured) stays.\n const status = await stripeClient.paymentIntents\n .retrieve(intentId)\n .then((intent) => intent.status)\n .catch(() => undefined)\n if (status === 'canceled') return\n throw new PaymentError('cancel_refused', `Stripe would not cancel ${intentId}`, {\n cause: err,\n })\n }\n },\n async parseWebhook(rawBody, signature): Promise<WebhookResult> {\n let event: Stripe.Event\n try {\n event = stripeClient.webhooks.constructEvent(rawBody, signature, cfg.webhookSecret)\n } catch (err) {\n throw new PaymentError('webhook_invalid', 'Stripe webhook signature invalid', {\n cause: err,\n })\n }\n const baseResult = { verified: true, eventId: event.id } as const\n switch (event.type) {\n case 'payment_intent.succeeded': {\n const intent = event.data.object as Stripe.PaymentIntent\n return {\n ...baseResult,\n kind: 'payment.captured',\n paymentIntentId: intent.id,\n amountMinor: intent.amount_received ?? intent.amount,\n currency: toIsoCurrency(intent.currency),\n raw: { ...intent } as unknown as Record<string, unknown>,\n }\n }\n case 'payment_intent.payment_failed': {\n const intent = event.data.object as Stripe.PaymentIntent\n return {\n ...baseResult,\n kind: 'payment.failed',\n paymentIntentId: intent.id,\n reason: intent.last_payment_error?.message ?? 'payment failed',\n }\n }\n case 'charge.refunded': {\n const charge = event.data.object as Stripe.Charge\n const pi =\n typeof charge.payment_intent === 'string'\n ? charge.payment_intent\n : charge.payment_intent?.id\n return {\n ...baseResult,\n kind: 'payment.refunded',\n ...(pi !== undefined && { paymentIntentId: pi }),\n amountMinor: charge.amount_refunded,\n currency: toIsoCurrency(charge.currency),\n }\n }\n default:\n logger.debug({ type: event.type }, 'stripe webhook ignored')\n return { ...baseResult, kind: 'ignored' }\n }\n },\n }\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,OAIK;;;ACLP,OAAO,YAAY;AACnB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OASK;AAoBA,IAAM,yBAAyB;AAMtC,SAAS,uBAAuB,OAAmE;AACjG,SAAO;AAAA,IACL,8BAA8B;AAAA,EAChC;AACF;AAOA,SAAS,cAAc,UAA0B;AAC/C,SAAO,SAAS,YAAY;AAC9B;AAEA,SAAS,UAAU,QAAoD;AACrE,UAAQ,QAAQ;AAAA,IACd,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,aAAO,WAAW,aAAa,cAAe;AAAA,IAChD;AACE,aAAO;AAAA,EAC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kD,IAAI,IAAI,IAAI;AAAA,MAClF,MAAM;AAAA,MACN,SAAS,EAAE,MAAM,IAAI,KAAK;AAAA,IAC5B,CAAC;AAAA,EACH;AACA,QAAM,SAAS,IAAI;AACnB,QAAM,iBAAiB,OAAO,kBAAkB,IAAI,IAAI,wBAAwB;AAChF,SAAO,4BAA4B;AAAA,IACjC,QAAQ,IAAI;AAAA,IACZ,QAAQ,EAAE,GAAG,QAAQ,GAAI,mBAAmB,UAAa,EAAE,eAAe,EAAG;AAAA,EAC/E,CAAC;AACH;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nymbalhq/payments-stripe",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "Stripe payments for Nymbal: the `stripe` payments provider",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"stripe": "^17.4.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@nymbalhq/types": "1.
|
|
36
|
+
"@nymbalhq/types": "1.6.0",
|
|
37
37
|
"@typescript/native": "npm:typescript@^7.0.2",
|
|
38
38
|
"fast-check": "^4.10.2",
|
|
39
39
|
"stripe": "^17.4.0",
|