@happyvertical/payments 0.105.4 → 0.105.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +108 -1
- package/dist/adapters/base-usdc.js +2 -2
- package/dist/adapters/btc.js +2 -2
- package/dist/adapters/btcpay.js +3 -3
- package/dist/adapters/stripe.d.ts +157 -0
- package/dist/adapters/stripe.d.ts.map +1 -1
- package/dist/adapters/stripe.js +224 -18
- package/dist/adapters/stripe.js.map +1 -1
- package/dist/chunks/{checkout-gateway-DG-LY0oG.js → checkout-gateway-Bb8UEwK8.js} +2 -2
- package/dist/chunks/{checkout-gateway-DG-LY0oG.js.map → checkout-gateway-Bb8UEwK8.js.map} +1 -1
- package/dist/chunks/{errors-feZrwnTy.js → errors-zSmk_AYY.js} +13 -2
- package/dist/chunks/{errors-feZrwnTy.js.map → errors-zSmk_AYY.js.map} +1 -1
- package/dist/chunks/{shared-DVl6UzD9.js → shared-oBgOhLsa.js} +2 -2
- package/dist/chunks/{shared-DVl6UzD9.js.map → shared-oBgOhLsa.js.map} +1 -1
- package/dist/errors.d.ts +10 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -34,7 +34,8 @@ import { StripeAdapter } from '@happyvertical/payments/stripe';
|
|
|
34
34
|
Greenfield client for billing integrations — see
|
|
35
35
|
[BTCPay Greenfield client](#btcpay-greenfield-client).
|
|
36
36
|
- `StripeAdapter`: Stripe Checkout URL settlement, webhook verification,
|
|
37
|
-
refunds, Stripe Connect Standard direct charges,
|
|
37
|
+
refunds, Stripe Connect Standard direct charges, Connect onboarding and
|
|
38
|
+
account-routed Connect webhooks, transfers, saved payment methods / card-on-file
|
|
38
39
|
(`createSetupSession` / `getSetupResult`), and the manual-capture card
|
|
39
40
|
lifecycle (`authorizePayment` / `capturePayment` / `voidPayment`).
|
|
40
41
|
|
|
@@ -78,6 +79,107 @@ propagates provider flags and account scope; it does not calculate allocations
|
|
|
78
79
|
or post accounting entries. `refundApplicationFee` and `reverseTransfer` are
|
|
79
80
|
sent only when explicitly requested.
|
|
80
81
|
|
|
82
|
+
### Stripe Connect onboarding and webhooks
|
|
83
|
+
|
|
84
|
+
Connect onboarding uses **Standard** accounts: the account holder (for example
|
|
85
|
+
a co-op tenant) owns its Stripe relationship and dashboard, and the platform
|
|
86
|
+
only connects to it. Onboarding and capability reads are platform calls; they
|
|
87
|
+
never send `Stripe-Account`, even on an account-scoped adapter.
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
const platform = new StripeAdapter({
|
|
91
|
+
secretKey: process.env.STRIPE_SECRET_KEY!,
|
|
92
|
+
webhookSecret: process.env.STRIPE_WEBHOOK_SECRET!, // platform endpoint
|
|
93
|
+
connectWebhookSecret: process.env.STRIPE_CONNECT_WEBHOOK_SECRET!, // Connect endpoint
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
// 1. Create the Standard account once and persist accountId with the tenant.
|
|
97
|
+
const account = await platform.createStandardAccount({
|
|
98
|
+
country: 'CA',
|
|
99
|
+
email: treasurerEmail,
|
|
100
|
+
metadata: { tenant: tenantId },
|
|
101
|
+
idempotencyKey: `connect-account:${tenantId}`,
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
// 2. Send the account holder through Stripe-hosted onboarding. Links are
|
|
105
|
+
// single use and short lived; refreshUrl should mint a new one.
|
|
106
|
+
const link = await platform.createOnboardingLink(
|
|
107
|
+
account.accountId,
|
|
108
|
+
'https://app.example/connect/return',
|
|
109
|
+
'https://app.example/connect/refresh',
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
// 3. On return (which does not mean onboarding finished), and on every
|
|
113
|
+
// account.updated webhook, read the capability state.
|
|
114
|
+
const state = await platform.getAccountCapabilities(account.accountId);
|
|
115
|
+
state.chargesEnabled; // charges_enabled
|
|
116
|
+
state.detailsSubmitted; // details_submitted
|
|
117
|
+
state.payoutsEnabled; // payouts_enabled
|
|
118
|
+
state.capabilities; // { card_payments: 'active', ... }
|
|
119
|
+
state.requirements; // { currentlyDue, eventuallyDue, pastDue, disabledReason }
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Treat the onboarding `url` as a bearer secret: redirect to it, but do not log
|
|
123
|
+
or store it.
|
|
124
|
+
|
|
125
|
+
Stripe delivers connected-account events to a separate **Connect** webhook
|
|
126
|
+
endpoint signed with its own secret. Route that endpoint through
|
|
127
|
+
`resolveConnectWebhookEvent`, which verifies the signature before reading the
|
|
128
|
+
payload, requires the event's `account`, and then calls your resolver to map
|
|
129
|
+
the account to its owner. An account the resolver does not recognize (it
|
|
130
|
+
returns `undefined` or `null`) is rejected with `PaymentNotOwnedError`; there
|
|
131
|
+
is no fallback to the platform account. An account-scoped adapter
|
|
132
|
+
(`stripeAccount` set) also rejects events for any other account.
|
|
133
|
+
|
|
134
|
+
```ts
|
|
135
|
+
// POST /webhooks/stripe/connect
|
|
136
|
+
const { event, account, owner } = await platform.resolveConnectWebhookEvent(
|
|
137
|
+
rawBody,
|
|
138
|
+
request.headers.get('Stripe-Signature') ?? undefined,
|
|
139
|
+
{ resolveAccount: (account) => tenants.findByStripeAccount(account) },
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
if (event.connect?.type === 'account.updated') {
|
|
143
|
+
await owner.saveStripeCapabilities(event.connect.account);
|
|
144
|
+
} else if (event.quoteId && event.status === 'confirmed') {
|
|
145
|
+
// The connected account chose quoteId; settle only the owner's own quote.
|
|
146
|
+
const quote = await owner.findQuote(event.quoteId);
|
|
147
|
+
if (!quote) throw new Error('quote does not belong to this account');
|
|
148
|
+
await quote.markPaid(event);
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**Bind quotes to the account before settling.** A connected account controls
|
|
153
|
+
the Checkout Sessions and PaymentIntents it creates, so the `quoteId` on a
|
|
154
|
+
Connect event is whatever that account chose, including another tenant's quote
|
|
155
|
+
id. Resolving `account` proves only who sent the event. Before marking a quote
|
|
156
|
+
paid, check that `event.quoteId` belongs to the resolved `owner` (reject the
|
|
157
|
+
event in `resolveAccount`, which receives it, or check it before settling), and
|
|
158
|
+
compare amount and currency with the stored quote.
|
|
159
|
+
|
|
160
|
+
`parseConnectWebhookEvent` performs the same verification without the
|
|
161
|
+
resolver and returns a `StripeConnectWebhookEvent` whose `account` is always
|
|
162
|
+
set. The platform endpoint (`parseWebhookEvent`) rejects any event carrying a
|
|
163
|
+
connected `account`, so a misrouted Connect delivery fails closed instead of
|
|
164
|
+
being processed as a platform payment.
|
|
165
|
+
|
|
166
|
+
Typed Connect payloads arrive on `event.connect`:
|
|
167
|
+
|
|
168
|
+
- `account.updated` (Connect endpoint): `{ type, account }` with the same
|
|
169
|
+
`StripeConnectAccountStatus` shape as `getAccountCapabilities`.
|
|
170
|
+
- `application_fee.created` / `application_fee.refunded` (platform endpoint,
|
|
171
|
+
because the fee belongs to the platform): `{ type, applicationFee }` with
|
|
172
|
+
`id`, `account` (the connected account charged), `amount`, `amountRefunded`,
|
|
173
|
+
`currency`, `refunded`, and `charge`. Route them with
|
|
174
|
+
`resolveConnectWebhookEvent(rawBody, signature, { endpoint: 'platform',
|
|
175
|
+
resolveAccount })`, which uses the fee's account and rejects platform events
|
|
176
|
+
that have none.
|
|
177
|
+
|
|
178
|
+
These events report `status: 'processing'`; they never mark a customer payment
|
|
179
|
+
refunded or failed. Duplicate detection records an event only after it
|
|
180
|
+
resolves, so a delivery rejected for an unmapped account is not reported as a
|
|
181
|
+
duplicate when Stripe retries it.
|
|
182
|
+
|
|
81
183
|
### BTCPay Greenfield client
|
|
82
184
|
|
|
83
185
|
`BtcpayClient` is a stateless client for one BTCPay Server store (Greenfield
|
|
@@ -250,6 +352,11 @@ Webhook parsing now requires configured secrets. Callers that previously parsed
|
|
|
250
352
|
Stripe or BTCPay webhooks without `webhookSecret` must configure the provider
|
|
251
353
|
secret or handle trusted test fixtures outside `parseWebhookEvent`.
|
|
252
354
|
|
|
355
|
+
`StripeAdapter.parseWebhookEvent` now rejects events that carry a connected
|
|
356
|
+
`account` with `PaymentVerificationError`. Stripe sends those only to Connect
|
|
357
|
+
endpoints; verify them with `connectWebhookSecret` through
|
|
358
|
+
`parseConnectWebhookEvent` or `resolveConnectWebhookEvent`.
|
|
359
|
+
|
|
253
360
|
Webhook parsing is fail-closed. `StripeAdapter.parseWebhookEvent` and
|
|
254
361
|
`BtcAdapter.parseWebhookEvent` require a configured `webhookSecret` and a valid
|
|
255
362
|
signature. BTCPay webhook payloads must include `deliveryId`; the exported
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { _ as normalizeUrlString, b as rememberPaymentOption, d as normalizeFutureDate, f as normalizeMaxStoredPaymentOptions, h as normalizePositiveMinorUnitAmount, i as decimalToMinorUnitAmount, l as normalizeCurrency, m as normalizeNonEmptyString, n as currencyMinorUnitDecimals, o as getFetch, p as normalizeMinorUnitAmount, r as decimalToAtomicUnits, s as minorUnitsToDecimal, u as normalizeDate, v as pollPaymentStatus, y as readJsonResponse } from "../chunks/shared-
|
|
1
|
+
import { i as PaymentProviderError, o as PaymentVerificationError, t as PaymentConfigurationError } from "../chunks/errors-zSmk_AYY.js";
|
|
2
|
+
import { _ as normalizeUrlString, b as rememberPaymentOption, d as normalizeFutureDate, f as normalizeMaxStoredPaymentOptions, h as normalizePositiveMinorUnitAmount, i as decimalToMinorUnitAmount, l as normalizeCurrency, m as normalizeNonEmptyString, n as currencyMinorUnitDecimals, o as getFetch, p as normalizeMinorUnitAmount, r as decimalToAtomicUnits, s as minorUnitsToDecimal, u as normalizeDate, v as pollPaymentStatus, y as readJsonResponse } from "../chunks/shared-oBgOhLsa.js";
|
|
3
3
|
import { createHash } from "node:crypto";
|
|
4
4
|
//#region src/adapters/base-usdc.ts
|
|
5
5
|
var BASE_USDC_BACKEND_ID = "base-usdc";
|
package/dist/adapters/btc.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { _ as normalizeUrlString, b as rememberPaymentOption, c as normalizeAmount, d as normalizeFutureDate, f as normalizeMaxStoredPaymentOptions, g as normalizePositivePaymentAmount, h as normalizePositiveMinorUnitAmount, i as decimalToMinorUnitAmount, m as normalizeNonEmptyString, n as currencyMinorUnitDecimals, o as getFetch, p as normalizeMinorUnitAmount, s as minorUnitsToDecimal, t as applyExpiryToPendingStatus, u as normalizeDate, v as pollPaymentStatus, y as readJsonResponse } from "../chunks/shared-
|
|
1
|
+
import { i as PaymentProviderError, t as PaymentConfigurationError } from "../chunks/errors-zSmk_AYY.js";
|
|
2
|
+
import { _ as normalizeUrlString, b as rememberPaymentOption, c as normalizeAmount, d as normalizeFutureDate, f as normalizeMaxStoredPaymentOptions, g as normalizePositivePaymentAmount, h as normalizePositiveMinorUnitAmount, i as decimalToMinorUnitAmount, m as normalizeNonEmptyString, n as currencyMinorUnitDecimals, o as getFetch, p as normalizeMinorUnitAmount, s as minorUnitsToDecimal, t as applyExpiryToPendingStatus, u as normalizeDate, v as pollPaymentStatus, y as readJsonResponse } from "../chunks/shared-oBgOhLsa.js";
|
|
3
3
|
import { createHmac, timingSafeEqual } from "node:crypto";
|
|
4
4
|
//#region src/adapters/btc.ts
|
|
5
5
|
var BTC_BACKEND_ID = "btc";
|
package/dist/adapters/btcpay.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as CryptoCheckoutNotOwnedError } from "../chunks/checkout-gateway-
|
|
3
|
-
import { n as currencyMinorUnitDecimals, o as getFetch } from "../chunks/shared-
|
|
1
|
+
import { i as PaymentProviderError, o as PaymentVerificationError, t as PaymentConfigurationError } from "../chunks/errors-zSmk_AYY.js";
|
|
2
|
+
import { t as CryptoCheckoutNotOwnedError } from "../chunks/checkout-gateway-Bb8UEwK8.js";
|
|
3
|
+
import { n as currencyMinorUnitDecimals, o as getFetch } from "../chunks/shared-oBgOhLsa.js";
|
|
4
4
|
import { createHmac, timingSafeEqual } from "node:crypto";
|
|
5
5
|
//#region src/adapters/btcpay-client.ts
|
|
6
6
|
/**
|
|
@@ -12,6 +12,12 @@ export interface StripeAdapterOptions {
|
|
|
12
12
|
cancelUrl?: string;
|
|
13
13
|
checkoutMode?: string;
|
|
14
14
|
webhookSecret?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Signing secret of the Stripe Connect webhook endpoint. Stripe signs
|
|
17
|
+
* connected-account events with a different secret from the platform
|
|
18
|
+
* endpoint; see {@link StripeAdapter.parseConnectWebhookEvent}.
|
|
19
|
+
*/
|
|
20
|
+
connectWebhookSecret?: string;
|
|
15
21
|
pollIntervalMs?: number;
|
|
16
22
|
maxStoredPaymentOptions?: number;
|
|
17
23
|
maxStoredWebhookEventIds?: number;
|
|
@@ -55,8 +61,106 @@ export interface StripeWebhookEvent extends PaymentWebhookEvent {
|
|
|
55
61
|
status: PaymentStatus;
|
|
56
62
|
quoteId?: string;
|
|
57
63
|
providerPaymentId?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Connected account (`acct_...`) the event originated from. Set only on
|
|
66
|
+
* events verified through {@link StripeAdapter.parseConnectWebhookEvent};
|
|
67
|
+
* platform-endpoint events never carry it.
|
|
68
|
+
*/
|
|
69
|
+
account?: string;
|
|
70
|
+
/** Typed Connect payload for `account.updated` and `application_fee.*`. */
|
|
71
|
+
connect?: StripeConnectEventDetail;
|
|
58
72
|
raw: unknown;
|
|
59
73
|
}
|
|
74
|
+
/** A Connect endpoint event: always scoped to a connected account. */
|
|
75
|
+
export interface StripeConnectWebhookEvent extends StripeWebhookEvent {
|
|
76
|
+
account: string;
|
|
77
|
+
}
|
|
78
|
+
export type StripeConnectEventDetail = {
|
|
79
|
+
type: 'account.updated';
|
|
80
|
+
account: StripeConnectAccountStatus;
|
|
81
|
+
} | {
|
|
82
|
+
type: 'application_fee.created' | 'application_fee.refunded';
|
|
83
|
+
applicationFee: StripeApplicationFee;
|
|
84
|
+
};
|
|
85
|
+
/** Connected account onboarding and capability state. */
|
|
86
|
+
export interface StripeConnectAccountStatus {
|
|
87
|
+
accountId: string;
|
|
88
|
+
/** Stripe account type (`standard`, `express`, `custom`) when reported. */
|
|
89
|
+
type?: string;
|
|
90
|
+
/** Stripe `charges_enabled`. */
|
|
91
|
+
chargesEnabled: boolean;
|
|
92
|
+
/** Stripe `details_submitted`. */
|
|
93
|
+
detailsSubmitted: boolean;
|
|
94
|
+
/** Stripe `payouts_enabled`. */
|
|
95
|
+
payoutsEnabled: boolean;
|
|
96
|
+
/** Per-capability state, e.g. `{ card_payments: 'active' }`. */
|
|
97
|
+
capabilities: Record<string, string>;
|
|
98
|
+
requirements: {
|
|
99
|
+
currentlyDue: string[];
|
|
100
|
+
eventuallyDue: string[];
|
|
101
|
+
pastDue: string[];
|
|
102
|
+
disabledReason?: string;
|
|
103
|
+
};
|
|
104
|
+
country?: string;
|
|
105
|
+
defaultCurrency?: string;
|
|
106
|
+
raw: unknown;
|
|
107
|
+
}
|
|
108
|
+
export interface StripeApplicationFee {
|
|
109
|
+
id: string;
|
|
110
|
+
/** Connected account the fee was collected from. */
|
|
111
|
+
account?: string;
|
|
112
|
+
/** Fee amount in integer minor units. */
|
|
113
|
+
amount?: number;
|
|
114
|
+
/** Refunded portion in integer minor units. */
|
|
115
|
+
amountRefunded?: number;
|
|
116
|
+
currency?: string;
|
|
117
|
+
refunded: boolean;
|
|
118
|
+
charge?: string;
|
|
119
|
+
livemode?: boolean;
|
|
120
|
+
raw: unknown;
|
|
121
|
+
}
|
|
122
|
+
export interface StripeCreateStandardAccountInput {
|
|
123
|
+
/** Two-letter ISO country code of the account holder. */
|
|
124
|
+
country?: string;
|
|
125
|
+
/** Prefills the account holder's email in Stripe onboarding. */
|
|
126
|
+
email?: string;
|
|
127
|
+
businessType?: 'individual' | 'company' | 'non_profit' | 'government_entity';
|
|
128
|
+
metadata?: Record<string, string | number | boolean | null | undefined>;
|
|
129
|
+
idempotencyKey?: string;
|
|
130
|
+
}
|
|
131
|
+
export interface StripeOnboardingLink {
|
|
132
|
+
/** Single-use Stripe-hosted onboarding URL; treat it as a bearer secret. */
|
|
133
|
+
url: string;
|
|
134
|
+
expiresAt?: Date;
|
|
135
|
+
raw: unknown;
|
|
136
|
+
}
|
|
137
|
+
export interface StripeCreateOnboardingLinkOptions {
|
|
138
|
+
/** Which requirements to collect up front; Stripe defaults to `currently_due`. */
|
|
139
|
+
collect?: 'currently_due' | 'eventually_due';
|
|
140
|
+
idempotencyKey?: string;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Host mapping from a connected account to its owner. Return `undefined` or
|
|
144
|
+
* `null` for an account the host does not recognize; the event is then
|
|
145
|
+
* rejected with {@link PaymentNotOwnedError}.
|
|
146
|
+
*/
|
|
147
|
+
export type StripeConnectAccountResolver<TOwner> = (account: string, event: StripeWebhookEvent) => TOwner | null | undefined | Promise<TOwner | null | undefined>;
|
|
148
|
+
export interface StripeResolveConnectWebhookOptions<TOwner> {
|
|
149
|
+
resolveAccount: StripeConnectAccountResolver<TOwner>;
|
|
150
|
+
/**
|
|
151
|
+
* Endpoint the delivery arrived on. `connect` (default) verifies with
|
|
152
|
+
* `connectWebhookSecret` and routes by the event's `account`. `platform`
|
|
153
|
+
* verifies with `webhookSecret` and routes `application_fee.*` events by the
|
|
154
|
+
* fee's connected account; other platform events are rejected.
|
|
155
|
+
*/
|
|
156
|
+
endpoint?: 'connect' | 'platform';
|
|
157
|
+
}
|
|
158
|
+
export interface StripeResolvedConnectWebhookEvent<TOwner> {
|
|
159
|
+
event: StripeWebhookEvent;
|
|
160
|
+
/** Connected account the event was routed by. */
|
|
161
|
+
account: string;
|
|
162
|
+
owner: TOwner;
|
|
163
|
+
}
|
|
60
164
|
export declare class StripeAdapter implements PaymentBackend {
|
|
61
165
|
private readonly options;
|
|
62
166
|
readonly capabilities: PaymentBackendCapabilities;
|
|
@@ -68,6 +172,7 @@ export declare class StripeAdapter implements PaymentBackend {
|
|
|
68
172
|
private readonly supportedCurrencies;
|
|
69
173
|
private readonly checkoutMode;
|
|
70
174
|
private readonly webhookSecret;
|
|
175
|
+
private readonly connectWebhookSecret;
|
|
71
176
|
private readonly stripeAccount;
|
|
72
177
|
private readonly maxStoredPaymentOptions;
|
|
73
178
|
private readonly maxStoredWebhookEventIds;
|
|
@@ -84,7 +189,59 @@ export declare class StripeAdapter implements PaymentBackend {
|
|
|
84
189
|
voidPayment(input: StripeVoidPaymentInput): Promise<VoidResult>;
|
|
85
190
|
createSetupSession(input: StripeCreateSetupSessionInput): Promise<SetupSession>;
|
|
86
191
|
getSetupResult(input: StripeGetSetupResultInput): Promise<SavedPaymentMethod>;
|
|
192
|
+
/**
|
|
193
|
+
* Verify and parse a delivery to the platform webhook endpoint. Events that
|
|
194
|
+
* carry a connected `account` are rejected: they belong to the Connect
|
|
195
|
+
* endpoint and must never be processed as platform-account events.
|
|
196
|
+
*/
|
|
87
197
|
parseWebhookEvent(payload: string, signature?: string): StripeWebhookEvent;
|
|
198
|
+
/**
|
|
199
|
+
* Verify a Stripe Connect endpoint delivery with `connectWebhookSecret`,
|
|
200
|
+
* then parse it. The signature is checked before the payload is parsed, and
|
|
201
|
+
* an event without a connected `account` is rejected. When this adapter is
|
|
202
|
+
* scoped to a `stripeAccount`, events for any other account are rejected.
|
|
203
|
+
* The payload, including `quoteId`, is controlled by the connected account:
|
|
204
|
+
* bind `quoteId` to `account` before acting on it.
|
|
205
|
+
*/
|
|
206
|
+
parseConnectWebhookEvent(payload: string, signature?: string): StripeConnectWebhookEvent;
|
|
207
|
+
/**
|
|
208
|
+
* Verify a webhook delivery, then map its connected account to an owner
|
|
209
|
+
* (for example a tenant) with the host's resolver. An account the resolver
|
|
210
|
+
* does not recognize is rejected with {@link PaymentNotOwnedError}; there is
|
|
211
|
+
* no fallback to the platform account. The event is recorded for duplicate
|
|
212
|
+
* detection only after it resolves, so a retried delivery that failed to
|
|
213
|
+
* resolve is not reported as a duplicate.
|
|
214
|
+
*
|
|
215
|
+
* Security: a connected account controls the objects it creates, so a
|
|
216
|
+
* Connect event's `quoteId` (and every other payload field) is chosen by
|
|
217
|
+
* that account. Resolving the account proves only who sent the event. The
|
|
218
|
+
* host must check that `event.quoteId` belongs to the resolved owner (for
|
|
219
|
+
* example inside `resolveAccount`, which receives the event, or before
|
|
220
|
+
* settling) and must never settle another owner's quote from it.
|
|
221
|
+
*/
|
|
222
|
+
resolveConnectWebhookEvent<TOwner>(payload: string, signature: string | undefined, options: StripeResolveConnectWebhookOptions<TOwner>): Promise<StripeResolvedConnectWebhookEvent<TOwner>>;
|
|
223
|
+
/**
|
|
224
|
+
* Create a Stripe Connect **Standard** account. The account holder owns the
|
|
225
|
+
* Stripe relationship and dashboard; the platform only connects to it.
|
|
226
|
+
* Always issued on the platform account, never on a connected account.
|
|
227
|
+
*/
|
|
228
|
+
createStandardAccount(input?: StripeCreateStandardAccountInput): Promise<StripeConnectAccountStatus>;
|
|
229
|
+
/**
|
|
230
|
+
* Create a single-use Account Link that sends the account holder through
|
|
231
|
+
* Stripe-hosted onboarding. `refreshUrl` is visited when the link expires or
|
|
232
|
+
* is reused, and should mint a new link; `returnUrl` does not mean
|
|
233
|
+
* onboarding finished, so read {@link getAccountCapabilities} afterwards.
|
|
234
|
+
*/
|
|
235
|
+
createOnboardingLink(accountId: string, returnUrl: string, refreshUrl: string, options?: StripeCreateOnboardingLinkOptions): Promise<StripeOnboardingLink>;
|
|
236
|
+
/**
|
|
237
|
+
* Read a connected account's onboarding and capability state
|
|
238
|
+
* (`charges_enabled`, `details_submitted`, `payouts_enabled`, per-capability
|
|
239
|
+
* status, and outstanding requirements).
|
|
240
|
+
*/
|
|
241
|
+
getAccountCapabilities(accountId: string): Promise<StripeConnectAccountStatus>;
|
|
242
|
+
private verifyWebhookEvent;
|
|
243
|
+
private recordWebhookEvent;
|
|
244
|
+
private assertAdapterAccount;
|
|
88
245
|
private stripeRequest;
|
|
89
246
|
private assertSupportedCurrency;
|
|
90
247
|
private resolveStripeRefundReferenceParam;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stripe.d.ts","sourceRoot":"","sources":["../../src/adapters/stripe.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stripe.d.ts","sourceRoot":"","sources":["../../src/adapters/stripe.ts"],"names":[],"mappings":"AAOA,OAAO,EAEL,KAAK,SAAS,EAaf,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EACV,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,aAAa,EACb,wBAAwB,EACxB,uBAAuB,EACvB,mBAAmB,EACnB,cAAc,EACd,0BAA0B,EAC1B,YAAY,EACZ,aAAa,EACb,aAAa,EACb,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,YAAY,EACZ,kBAAkB,EAClB,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,iBAAiB,EAClB,MAAM,aAAa,CAAC;AAErB,eAAO,MAAM,iBAAiB,WAAW,CAAC;AAM1C,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,2EAA2E;IAC3E,aAAa,CAAC,EAAE,MAAM,CAA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