@dime-technology/dime-js-sdk 1.3.1 → 1.4.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/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  declare const DEFAULT_BASE_URL = "https://app.dimepayments.com";
2
- declare const VERSION = "1.3.1";
2
+ declare const VERSION = "1.4.0";
3
3
  interface ConfigOptions {
4
4
  /** Sanctum personal access token (sent as Bearer). */
5
5
  token: string;
@@ -28,7 +28,7 @@ declare class Config {
28
28
  baseUri(): string;
29
29
  }
30
30
 
31
- type Raw$x = Record<string, unknown>;
31
+ type Raw$Q = Record<string, unknown>;
32
32
  declare class Address {
33
33
  readonly id?: number | undefined;
34
34
  readonly recipient?: string | undefined;
@@ -39,14 +39,14 @@ declare class Address {
39
39
  readonly state?: string | undefined;
40
40
  readonly zip?: string | undefined;
41
41
  constructor(id?: number | undefined, recipient?: string | undefined, lineOne?: string | undefined, lineTwo?: string | undefined, lineThree?: string | undefined, city?: string | undefined, state?: string | undefined, zip?: string | undefined);
42
- static fromRaw(data: Raw$x): Address;
42
+ static fromRaw(data: Raw$Q): Address;
43
43
  }
44
44
 
45
- type Raw$w = Record<string, unknown>;
45
+ type Raw$P = Record<string, unknown>;
46
46
  declare class MessageResult {
47
47
  readonly message?: string | undefined;
48
48
  constructor(message?: string | undefined);
49
- static fromRaw(data: Raw$w): MessageResult;
49
+ static fromRaw(data: Raw$P): MessageResult;
50
50
  }
51
51
 
52
52
  type PageFetcher<T> = (cursor: string) => Promise<CursorPage<T>>;
@@ -66,7 +66,13 @@ declare class CursorPage<T> {
66
66
  get length(): number;
67
67
  }
68
68
 
69
- type Raw$v = Record<string, unknown>;
69
+ type Raw$O = Record<string, unknown>;
70
+ interface MultipartFile {
71
+ /** The form field name, e.g. `files[]`. */
72
+ field: string;
73
+ content: Blob;
74
+ filename: string;
75
+ }
70
76
  declare class Transport {
71
77
  private readonly config;
72
78
  private readonly fetchFn;
@@ -81,32 +87,96 @@ declare class Transport {
81
87
  * serialised into the query string (`data[sid]=…&filters[status]=…`) and no
82
88
  * body is sent; every other method sends the envelope as a JSON body.
83
89
  */
84
- request(method: string, path: string, body?: Raw$v, query?: Record<string, string>): Promise<Raw$v>;
90
+ request(method: string, path: string, body?: Raw$O, query?: Record<string, string>): Promise<Raw$O>;
91
+ /**
92
+ * Execute a `multipart/form-data` request and return the decoded JSON body.
93
+ *
94
+ * Multipart has no JSON parsing, so the envelope is sent as bracketed form
95
+ * fields (`data[sid]=…`) — a single `data` field holding JSON would be read
96
+ * as a plain string. No Content-Type is set here: fetch derives it, boundary
97
+ * included, from the FormData body.
98
+ */
99
+ requestMultipart(method: string, path: string, body: Raw$O, files: MultipartFile[]): Promise<Raw$O>;
100
+ private headers;
85
101
  private attempt;
86
102
  private sleep;
87
103
  }
88
104
 
89
- type Raw$u = Record<string, unknown>;
105
+ type Raw$N = Record<string, unknown>;
90
106
  declare abstract class AbstractResource {
91
107
  protected readonly transport: Transport;
92
108
  constructor(transport: Transport);
93
109
  /**
94
110
  * Build the standard Dime request envelope, dropping null/undefined values.
95
111
  */
96
- protected envelope(data?: Raw$u, filters?: Raw$u): Raw$u;
97
- protected paginate<T>(method: string, path: string, body: Raw$u, map: (item: Raw$u) => T, query?: Record<string, string>): Promise<CursorPage<T>>;
112
+ protected envelope(data?: Raw$N, filters?: Raw$N): Raw$N;
113
+ protected paginate<T>(method: string, path: string, body: Raw$N, map: (item: Raw$N) => T, query?: Record<string, string>): Promise<CursorPage<T>>;
98
114
  }
99
115
 
100
- type Raw$t = Record<string, unknown>;
116
+ type Raw$M = Record<string, unknown>;
101
117
  declare class Addresses extends AbstractResource {
102
118
  list(sid: string, uuid: string): Promise<CursorPage<Address>>;
103
119
  show(sid: string, uuid: string, addressId: number | string): Promise<Address>;
104
- create(sid: string, uuid: string, attributes: Raw$t): Promise<Address>;
105
- update(sid: string, uuid: string, addressId: number | string, attributes: Raw$t): Promise<Address>;
120
+ create(sid: string, uuid: string, attributes: Raw$M): Promise<Address>;
121
+ update(sid: string, uuid: string, addressId: number | string, attributes: Raw$M): Promise<Address>;
106
122
  delete(sid: string, uuid: string, addressId: number | string): Promise<MessageResult>;
107
123
  }
108
124
 
109
- type Raw$s = Record<string, unknown>;
125
+ type Raw$L = Record<string, unknown>;
126
+ /**
127
+ * A chargeback raised against a merchant, as of the processor's most recent
128
+ * daily file. The same shape the `chargeback_*` webhooks carry.
129
+ *
130
+ * `transactionInfoId` identifies the chargeback itself; the disputed payment is
131
+ * `parentTransactionInfoId`. Amounts are kept as strings to avoid float rounding.
132
+ */
133
+ declare class Chargeback {
134
+ readonly transactionInfoId?: string | undefined;
135
+ readonly parentTransactionInfoId?: string | undefined;
136
+ readonly gatewayTransactionId?: string | undefined;
137
+ readonly transactionNumber?: string | undefined;
138
+ readonly invoiceNumber?: string | undefined;
139
+ readonly chargebackDate?: string | undefined;
140
+ readonly merchantChargebackDate?: string | undefined;
141
+ readonly transactionAmount?: string | undefined;
142
+ readonly chargebackAmount?: string | undefined;
143
+ readonly cardBrand?: string | undefined;
144
+ readonly ccLastFour?: string | undefined;
145
+ readonly payeeName?: string | undefined;
146
+ readonly daysToRepresent?: number | undefined;
147
+ readonly representmentDate?: string | undefined;
148
+ readonly merchantRepresentmentDate?: string | undefined;
149
+ readonly representmentStatus?: string | undefined;
150
+ readonly result?: string | undefined;
151
+ readonly chargebackCode?: string | undefined;
152
+ readonly chargebackResponseCode?: string | undefined;
153
+ readonly resolved: boolean;
154
+ constructor(transactionInfoId?: string | undefined, parentTransactionInfoId?: string | undefined, gatewayTransactionId?: string | undefined, transactionNumber?: string | undefined, invoiceNumber?: string | undefined, chargebackDate?: string | undefined, merchantChargebackDate?: string | undefined, transactionAmount?: string | undefined, chargebackAmount?: string | undefined, cardBrand?: string | undefined, ccLastFour?: string | undefined, payeeName?: string | undefined, daysToRepresent?: number | undefined, representmentDate?: string | undefined, merchantRepresentmentDate?: string | undefined, representmentStatus?: string | undefined, result?: string | undefined, chargebackCode?: string | undefined, chargebackResponseCode?: string | undefined, resolved?: boolean);
155
+ static fromRaw(data: Raw$L): Chargeback;
156
+ }
157
+
158
+ type Raw$K = Record<string, unknown>;
159
+ /**
160
+ * Chargebacks raised against a merchant. Needs the `chargeback:read` ability.
161
+ *
162
+ * The data arrives in a once-daily file from the processor, so it reflects the
163
+ * latest import rather than live dispute activity. Pair it with the
164
+ * `chargeback_opened` / `chargeback_updated` / `chargeback_resolved` webhooks
165
+ * and use these endpoints to reconcile or backfill.
166
+ */
167
+ declare class Chargebacks extends AbstractResource {
168
+ /**
169
+ * List a merchant's chargebacks.
170
+ *
171
+ * @param filters `start_date` and `end_date` (UTC, `Y-m-d H:i:s`, sent
172
+ * together), `representment_status` (free text from the processor, e.g.
173
+ * `New` or `Resolved`)
174
+ */
175
+ list(sid: string, filters?: Raw$K): Promise<CursorPage<Chargeback>>;
176
+ show(sid: string, transactionInfoId: string): Promise<Chargeback>;
177
+ }
178
+
179
+ type Raw$J = Record<string, unknown>;
110
180
  declare class Customer {
111
181
  readonly uuid?: string | undefined;
112
182
  readonly firstName?: string | undefined;
@@ -121,19 +191,19 @@ declare class Customer {
121
191
  readonly zip?: string | undefined;
122
192
  readonly country?: string | undefined;
123
193
  constructor(uuid?: string | undefined, firstName?: string | undefined, lastName?: string | undefined, phone?: string | undefined, email?: string | undefined, addr1?: string | undefined, addr2?: string | undefined, addr3?: string | undefined, city?: string | undefined, state?: string | undefined, zip?: string | undefined, country?: string | undefined);
124
- static fromRaw(data: Raw$s): Customer;
194
+ static fromRaw(data: Raw$J): Customer;
125
195
  }
126
196
 
127
- type Raw$r = Record<string, unknown>;
197
+ type Raw$I = Record<string, unknown>;
128
198
  declare class Customers extends AbstractResource {
129
- list(sid: string, filters?: Raw$r): Promise<CursorPage<Customer>>;
130
- show(sid: string, filters: Raw$r): Promise<Customer>;
131
- create(sid: string, attributes: Raw$r): Promise<Customer>;
132
- update(sid: string, filters: Raw$r, attributes: Raw$r): Promise<Customer>;
133
- delete(sid: string, filters: Raw$r): Promise<MessageResult>;
199
+ list(sid: string, filters?: Raw$I): Promise<CursorPage<Customer>>;
200
+ show(sid: string, filters: Raw$I): Promise<Customer>;
201
+ create(sid: string, attributes: Raw$I): Promise<Customer>;
202
+ update(sid: string, filters: Raw$I, attributes: Raw$I): Promise<Customer>;
203
+ delete(sid: string, filters: Raw$I): Promise<MessageResult>;
134
204
  }
135
205
 
136
- type Raw$q = Record<string, unknown>;
206
+ type Raw$H = Record<string, unknown>;
137
207
  declare class Deposit {
138
208
  readonly transactionDate?: string | undefined;
139
209
  readonly fundDate?: string | undefined;
@@ -145,10 +215,10 @@ declare class Deposit {
145
215
  readonly sweepId?: string | undefined;
146
216
  readonly type?: string | undefined;
147
217
  constructor(transactionDate?: string | undefined, fundDate?: string | undefined, transactionInfoId?: string | undefined, transactionId?: string | undefined, transactionDetailAccount?: string | undefined, authorizationAmount?: string | undefined, netAmount?: string | undefined, sweepId?: string | undefined, type?: string | undefined);
148
- static fromRaw(data: Raw$q): Deposit;
218
+ static fromRaw(data: Raw$H): Deposit;
149
219
  }
150
220
 
151
- type Raw$p = Record<string, unknown>;
221
+ type Raw$G = Record<string, unknown>;
152
222
  declare class TransactionAddress {
153
223
  readonly firstName?: string | undefined;
154
224
  readonly lastName?: string | undefined;
@@ -158,10 +228,10 @@ declare class TransactionAddress {
158
228
  readonly state?: string | undefined;
159
229
  readonly zip?: string | undefined;
160
230
  constructor(firstName?: string | undefined, lastName?: string | undefined, addr1?: string | undefined, addr2?: string | undefined, city?: string | undefined, state?: string | undefined, zip?: string | undefined);
161
- static fromRaw(data: Raw$p): TransactionAddress;
231
+ static fromRaw(data: Raw$G): TransactionAddress;
162
232
  }
163
233
 
164
- type Raw$o = Record<string, unknown>;
234
+ type Raw$F = Record<string, unknown>;
165
235
  declare class Transaction {
166
236
  readonly transactionType?: string | undefined;
167
237
  readonly transactionStatus?: string | undefined;
@@ -184,10 +254,10 @@ declare class Transaction {
184
254
  readonly billingAddress: TransactionAddress;
185
255
  readonly shippingAddress: TransactionAddress;
186
256
  constructor(transactionType?: string | undefined, transactionStatus?: string | undefined, transactionStatusDescription?: string | undefined, transactionNumber?: string | undefined, transactionDate?: string | undefined, fundDate?: string | undefined, settleDate?: string | undefined, amount?: string | undefined, description?: string | undefined, statusCode?: string | undefined, statusText?: string | undefined, email?: string | undefined, phone?: string | undefined, customerUuid?: string | undefined, multiUseToken?: string | undefined, pending?: boolean, transactionInfoId?: string | undefined, parentTransactionInfoId?: string | undefined, billingAddress?: TransactionAddress, shippingAddress?: TransactionAddress);
187
- static fromRaw(data: Raw$o): Transaction;
257
+ static fromRaw(data: Raw$F): Transaction;
188
258
  }
189
259
 
190
- type Raw$n = Record<string, unknown>;
260
+ type Raw$E = Record<string, unknown>;
191
261
  declare class DepositWithTransactions {
192
262
  readonly sid?: string | undefined;
193
263
  readonly transactionInfoId?: string | undefined;
@@ -199,26 +269,245 @@ declare class DepositWithTransactions {
199
269
  readonly transTotal?: string | undefined;
200
270
  readonly transactions: Transaction[];
201
271
  constructor(sid?: string | undefined, transactionInfoId?: string | undefined, transactionId?: string | undefined, transactionDate?: string | undefined, fundDate?: string | undefined, type?: string | undefined, countOfTransactions?: number | undefined, transTotal?: string | undefined, transactions?: Transaction[]);
202
- static fromRaw(data: Raw$n): DepositWithTransactions;
272
+ static fromRaw(data: Raw$E): DepositWithTransactions;
203
273
  }
204
274
 
205
- type Raw$m = Record<string, unknown>;
275
+ type Raw$D = Record<string, unknown>;
206
276
  declare class DepositGroup {
207
277
  readonly sid?: string | undefined;
208
278
  readonly count?: number | undefined;
209
279
  readonly deposits: DepositWithTransactions[];
210
280
  constructor(sid?: string | undefined, count?: number | undefined, deposits?: DepositWithTransactions[]);
211
- static fromRaw(data: Raw$m): DepositGroup;
281
+ static fromRaw(data: Raw$D): DepositGroup;
212
282
  }
213
283
 
214
- type Raw$l = Record<string, unknown>;
284
+ type Raw$C = Record<string, unknown>;
215
285
  declare class Deposits extends AbstractResource {
216
- list(sid: string, filters?: Raw$l): Promise<CursorPage<Deposit>>;
217
- listWithTransactions(sid: string, filters: Raw$l): Promise<DepositGroup>;
218
- show(sid: string, identifier: Raw$l): Promise<DepositWithTransactions>;
286
+ list(sid: string, filters?: Raw$C): Promise<CursorPage<Deposit>>;
287
+ listWithTransactions(sid: string, filters: Raw$C): Promise<DepositGroup>;
288
+ show(sid: string, identifier: Raw$C): Promise<DepositWithTransactions>;
219
289
  }
220
290
 
221
- type Raw$k = Record<string, unknown>;
291
+ type Raw$B = Record<string, unknown>;
292
+ declare class DocumentUploadFailure {
293
+ readonly fileName?: string | undefined;
294
+ readonly reason?: string | undefined;
295
+ constructor(fileName?: string | undefined, reason?: string | undefined);
296
+ static fromRaw(data: Raw$B): DocumentUploadFailure;
297
+ }
298
+
299
+ type Raw$A = Record<string, unknown>;
300
+ /**
301
+ * A document held for a merchant. Named `MerchantDocument` rather than
302
+ * `Document` so it does not shadow the DOM's global `Document` type.
303
+ *
304
+ * The upload response carries only `uuid`, `fileName`, `docType` and `size`;
305
+ * the list response fills in the rest. `sentToProcessorAt` and
306
+ * `processorResponse` stay undefined until our team forwards the document.
307
+ */
308
+ declare class MerchantDocument {
309
+ readonly uuid?: string | undefined;
310
+ readonly fileName?: string | undefined;
311
+ readonly docType?: string | undefined;
312
+ readonly chargebackTransactionInfoId?: string | undefined;
313
+ readonly size?: number | undefined;
314
+ readonly uploadedAt?: string | undefined;
315
+ readonly uploadedVia?: string | undefined;
316
+ readonly sentToProcessorAt?: string | undefined;
317
+ readonly processorResponse?: string | undefined;
318
+ constructor(uuid?: string | undefined, fileName?: string | undefined, docType?: string | undefined, chargebackTransactionInfoId?: string | undefined, size?: number | undefined, uploadedAt?: string | undefined, uploadedVia?: string | undefined, sentToProcessorAt?: string | undefined, processorResponse?: string | undefined);
319
+ static fromRaw(data: Raw$A): MerchantDocument;
320
+ }
321
+
322
+ type Raw$z = Record<string, unknown>;
323
+ /**
324
+ * The outcome of a document upload. Files are stored independently, so a
325
+ * request can partly succeed: `documents` lists what was stored and `failed`
326
+ * what was not, so only the failures need re-sending.
327
+ */
328
+ declare class DocumentUploadResult {
329
+ readonly message?: string | undefined;
330
+ readonly documents: MerchantDocument[];
331
+ readonly failed: DocumentUploadFailure[];
332
+ constructor(message?: string | undefined, documents?: MerchantDocument[], failed?: DocumentUploadFailure[]);
333
+ static fromRaw(data: Raw$z): DocumentUploadResult;
334
+ }
335
+
336
+ type Raw$y = Record<string, unknown>;
337
+ /**
338
+ * A file to upload: a `Blob` or `File`, or raw bytes (a Node `Buffer` from
339
+ * `fs.readFile`, say) with a file name. A bare `Blob` without a name is sent
340
+ * as `document`. The server identifies the type from the content, so
341
+ * `contentType` is optional.
342
+ */
343
+ type DocumentFile = Blob | {
344
+ content: Blob | ArrayBuffer | Uint8Array;
345
+ filename: string;
346
+ contentType?: string;
347
+ };
348
+ /**
349
+ * Documents held for a merchant: underwriting paperwork, identity
350
+ * verification, and evidence contesting a chargeback.
351
+ */
352
+ declare class Documents extends AbstractResource {
353
+ /**
354
+ * Upload up to 10 documents for a merchant (PDF, JPG, PNG, DOC, DOCX or RTF,
355
+ * each 9 MB or smaller). Sent as `multipart/form-data`.
356
+ *
357
+ * Files are stored independently: check `failed` on the result and re-send
358
+ * only those. A 413 means the request as a whole was too large — send fewer
359
+ * files per request.
360
+ *
361
+ * Uploading does not forward the document to the processor; our team
362
+ * reviews it and does that.
363
+ *
364
+ * @param docType `Verification`, `FraudHolds`, `Underwriting` or
365
+ * `RetrievalRequest` (evidence for a chargeback or retrieval request)
366
+ * @param chargebackTransactionInfoId attach the files as evidence to this
367
+ * chargeback (its `transactionInfoId`)
368
+ */
369
+ upload(sid: string, docType: string, files: DocumentFile[], chargebackTransactionInfoId?: string): Promise<DocumentUploadResult>;
370
+ /**
371
+ * List the documents held for a merchant, whether uploaded through the API,
372
+ * by our team, or through the merchant application.
373
+ *
374
+ * @param filters `doc_type`, `chargeback_transaction_info_id`
375
+ */
376
+ list(sid: string, filters?: Raw$y): Promise<MerchantDocument[]>;
377
+ }
378
+
379
+ type Raw$x = Record<string, unknown>;
380
+ /**
381
+ * A release of held funds to the merchant's bank account.
382
+ *
383
+ * `status` is `released`, `failed` (declined, nothing moved — see
384
+ * `failureReason`) or `unknown` (no confirmation came back; it may have gone
385
+ * through, and its amount is held back from `releasable` until reconciled).
386
+ * `transactionInfoIds` is empty for a release requested by amount.
387
+ */
388
+ declare class FundRelease {
389
+ readonly id?: number | undefined;
390
+ readonly amount?: string | undefined;
391
+ readonly fee?: string | undefined;
392
+ readonly status?: string | undefined;
393
+ readonly statusLabel?: string | undefined;
394
+ readonly idempotencyKey?: string | undefined;
395
+ readonly transactionInfoIds: string[];
396
+ readonly failureReason?: string | undefined;
397
+ readonly requestedAt?: string | undefined;
398
+ readonly completedAt?: string | undefined;
399
+ constructor(id?: number | undefined, amount?: string | undefined, fee?: string | undefined, status?: string | undefined, statusLabel?: string | undefined, idempotencyKey?: string | undefined, transactionInfoIds?: string[], failureReason?: string | undefined, requestedAt?: string | undefined, completedAt?: string | undefined);
400
+ static fromRaw(data: Raw$x): FundRelease;
401
+ }
402
+
403
+ type Raw$w = Record<string, unknown>;
404
+ /**
405
+ * The response to a release request. `replayed` is true when the idempotency
406
+ * key had been used before and the original release is being returned rather
407
+ * than a new one sent.
408
+ */
409
+ declare class FundReleaseResult {
410
+ readonly sid?: string | undefined;
411
+ readonly replayed: boolean;
412
+ readonly release: FundRelease;
413
+ constructor(sid?: string | undefined, replayed?: boolean, release?: FundRelease);
414
+ static fromRaw(data: Raw$w): FundReleaseResult;
415
+ }
416
+
417
+ type Raw$v = Record<string, unknown>;
418
+ /**
419
+ * A held-funds merchant's balance at the processor, in dollars.
420
+ *
421
+ * `releasable` is the figure that matters, and the one a release is checked
422
+ * against: `available` less `atRisk`, `owedToSplit`, `unresolved` and
423
+ * `releaseFee`, never below zero and never above `achOutLimitRemaining`.
424
+ *
425
+ * Monetary values are kept as strings to avoid float rounding.
426
+ */
427
+ declare class HeldBalance {
428
+ readonly sid?: string | undefined;
429
+ readonly available?: string | undefined;
430
+ readonly pending?: string | undefined;
431
+ readonly reserve?: string | undefined;
432
+ readonly atRisk?: string | undefined;
433
+ readonly owedToSplit?: string | undefined;
434
+ readonly unresolved?: string | undefined;
435
+ readonly releaseFee?: string | undefined;
436
+ readonly releasable?: string | undefined;
437
+ readonly achSettlementDays?: number | undefined;
438
+ readonly achOutEnabled: boolean;
439
+ readonly achOutLimitRemaining?: string | undefined;
440
+ constructor(sid?: string | undefined, available?: string | undefined, pending?: string | undefined, reserve?: string | undefined, atRisk?: string | undefined, owedToSplit?: string | undefined, unresolved?: string | undefined, releaseFee?: string | undefined, releasable?: string | undefined, achSettlementDays?: number | undefined, achOutEnabled?: boolean, achOutLimitRemaining?: string | undefined);
441
+ static fromRaw(data: Raw$v): HeldBalance;
442
+ }
443
+
444
+ type Raw$u = Record<string, unknown>;
445
+ /**
446
+ * A payment that can be released from a held balance. `amount` is what
447
+ * releasing it pays the merchant: `netAmount` less `splitAmount`.
448
+ */
449
+ declare class ReleasableTransaction {
450
+ readonly transactionInfoId?: string | undefined;
451
+ readonly type?: string | undefined;
452
+ readonly transactionDate?: string | undefined;
453
+ readonly grossAmount?: string | undefined;
454
+ readonly netAmount?: string | undefined;
455
+ readonly splitAmount?: string | undefined;
456
+ readonly amount?: string | undefined;
457
+ constructor(transactionInfoId?: string | undefined, type?: string | undefined, transactionDate?: string | undefined, grossAmount?: string | undefined, netAmount?: string | undefined, splitAmount?: string | undefined, amount?: string | undefined);
458
+ static fromRaw(data: Raw$u): ReleasableTransaction;
459
+ }
460
+
461
+ type Raw$t = Record<string, unknown>;
462
+ /**
463
+ * The payments releasable right now, newest first and capped at 500 —
464
+ * `truncated` says whether there were more.
465
+ */
466
+ declare class ReleasableTransactions {
467
+ readonly sid?: string | undefined;
468
+ readonly transactions: ReleasableTransaction[];
469
+ readonly total?: string | undefined;
470
+ readonly truncated: boolean;
471
+ constructor(sid?: string | undefined, transactions?: ReleasableTransaction[], total?: string | undefined, truncated?: boolean);
472
+ static fromRaw(data: Raw$t): ReleasableTransactions;
473
+ }
474
+
475
+ type Raw$s = Record<string, unknown>;
476
+ /**
477
+ * Held funds, for merchants on a tier that does not sweep their balance to
478
+ * their bank automatically. Every other merchant gets a 422 from these
479
+ * endpoints rather than a misleading zero.
480
+ *
481
+ * Reading needs `funds:read`. Releasing needs `funds:release`, a separate
482
+ * ability, and is open to affiliate keys only.
483
+ */
484
+ declare class Funds extends AbstractResource {
485
+ /** The merchant's balance at the processor, and how much is releasable today. */
486
+ balance(sid: string): Promise<HeldBalance>;
487
+ /** The payments that can be released right now — the list to release by `transaction_info_ids`. */
488
+ transactions(sid: string): Promise<ReleasableTransactions>;
489
+ /**
490
+ * Send part of a merchant's held balance to the bank account on file.
491
+ *
492
+ * Use a fresh `idempotencyKey` per intended release and reuse it when
493
+ * retrying: a retry with the same key and request returns the original
494
+ * release instead of sending the money again. The SDK's own retries of
495
+ * timeouts and 5xx responses resend the same key, so they are safe.
496
+ *
497
+ * Check `release.status`, not only whether this resolved. A declined release
498
+ * (`failed`) is returned rather than thrown, alongside `released` and
499
+ * `unknown`. Refusals that create no release — a transaction that does not
500
+ * qualify, more than is releasable, a key reused for a different request, a
501
+ * release already in flight — throw an {@link ApiException} whose response
502
+ * body carries the detail (`data.ineligible`, `data.releasable`).
503
+ *
504
+ * @param attributes exactly one of `amount` (dollars, at most two decimal
505
+ * places) or `transaction_info_ids` (up to 100, all or nothing)
506
+ */
507
+ release(sid: string, idempotencyKey: string, attributes: Raw$s): Promise<FundReleaseResult>;
508
+ }
509
+
510
+ type Raw$r = Record<string, unknown>;
222
511
  /**
223
512
  * The processing fee a cover-fee invoice adds on top of what the customer pays,
224
513
  * quoted for both payment methods.
@@ -244,29 +533,29 @@ declare class CoverFeeQuote {
244
533
  readonly achFee?: string | undefined;
245
534
  readonly achTotal?: string | undefined;
246
535
  constructor(basis?: string | undefined, base?: string | undefined, ccFee?: string | undefined, ccTotal?: string | undefined, achFee?: string | undefined, achTotal?: string | undefined);
247
- static fromRaw(data: Raw$k): CoverFeeQuote;
536
+ static fromRaw(data: Raw$r): CoverFeeQuote;
248
537
  }
249
538
 
250
- type Raw$j = Record<string, unknown>;
539
+ type Raw$q = Record<string, unknown>;
251
540
  declare class InvoiceCustomer {
252
541
  readonly id?: number | undefined;
253
542
  readonly name?: string | undefined;
254
543
  readonly email?: string | undefined;
255
544
  constructor(id?: number | undefined, name?: string | undefined, email?: string | undefined);
256
- static fromRaw(data: Raw$j): InvoiceCustomer;
545
+ static fromRaw(data: Raw$q): InvoiceCustomer;
257
546
  }
258
547
 
259
- type Raw$i = Record<string, unknown>;
548
+ type Raw$p = Record<string, unknown>;
260
549
  declare class InvoiceEvent {
261
550
  readonly type?: string | undefined;
262
551
  readonly label?: string | undefined;
263
552
  readonly description?: string | undefined;
264
553
  readonly createdAt?: string | undefined;
265
554
  constructor(type?: string | undefined, label?: string | undefined, description?: string | undefined, createdAt?: string | undefined);
266
- static fromRaw(data: Raw$i): InvoiceEvent;
555
+ static fromRaw(data: Raw$p): InvoiceEvent;
267
556
  }
268
557
 
269
- type Raw$h = Record<string, unknown>;
558
+ type Raw$o = Record<string, unknown>;
270
559
  declare class InvoiceLineItem {
271
560
  readonly id?: number | undefined;
272
561
  readonly itemId?: number | undefined;
@@ -276,10 +565,10 @@ declare class InvoiceLineItem {
276
565
  readonly unitPrice?: string | undefined;
277
566
  readonly amount?: string | undefined;
278
567
  constructor(id?: number | undefined, itemId?: number | undefined, name?: string | undefined, description?: string | undefined, quantity?: string | undefined, unitPrice?: string | undefined, amount?: string | undefined);
279
- static fromRaw(data: Raw$h): InvoiceLineItem;
568
+ static fromRaw(data: Raw$o): InvoiceLineItem;
280
569
  }
281
570
 
282
- type Raw$g = Record<string, unknown>;
571
+ type Raw$n = Record<string, unknown>;
283
572
  /**
284
573
  * A payment recorded against an invoice.
285
574
  *
@@ -294,10 +583,10 @@ declare class InvoicePayment {
294
583
  readonly transactionId?: string | undefined;
295
584
  readonly coverFee?: string | undefined;
296
585
  constructor(amount?: string | undefined, paidAt?: string | undefined, method?: string | undefined, transactionId?: string | undefined, coverFee?: string | undefined);
297
- static fromRaw(data: Raw$g): InvoicePayment;
586
+ static fromRaw(data: Raw$n): InvoicePayment;
298
587
  }
299
588
 
300
- type Raw$f = Record<string, unknown>;
589
+ type Raw$m = Record<string, unknown>;
301
590
  declare class Invoice {
302
591
  readonly id?: number | undefined;
303
592
  readonly invoiceNumber?: string | undefined;
@@ -323,10 +612,10 @@ declare class Invoice {
323
612
  readonly coverFeeRequired: boolean;
324
613
  readonly coverFeeQuote?: CoverFeeQuote | undefined;
325
614
  constructor(id?: number | undefined, invoiceNumber?: string | undefined, status?: string | undefined, token?: string | undefined, paymentTerms?: string | undefined, issueDate?: string | undefined, dueDate?: string | undefined, isOverdue?: boolean, subtotal?: string | undefined, total?: string | undefined, amountPaid?: string | undefined, balance?: string | undefined, allowPartialPayment?: boolean, thankYouNote?: string | undefined, customerName?: string | undefined, customerEmail?: string | undefined, publicUrl?: string | undefined, customer?: InvoiceCustomer, items?: InvoiceLineItem[], payments?: InvoicePayment[], events?: InvoiceEvent[], coverFeeRequired?: boolean, coverFeeQuote?: CoverFeeQuote | undefined);
326
- static fromRaw(data: Raw$f): Invoice;
615
+ static fromRaw(data: Raw$m): Invoice;
327
616
  }
328
617
 
329
- type Raw$e = Record<string, unknown>;
618
+ type Raw$l = Record<string, unknown>;
330
619
  declare class InvoiceItem {
331
620
  readonly id?: number | undefined;
332
621
  readonly name?: string | undefined;
@@ -334,18 +623,18 @@ declare class InvoiceItem {
334
623
  readonly price?: string | undefined;
335
624
  readonly taxDeductible: boolean;
336
625
  constructor(id?: number | undefined, name?: string | undefined, description?: string | undefined, price?: string | undefined, taxDeductible?: boolean);
337
- static fromRaw(data: Raw$e): InvoiceItem;
626
+ static fromRaw(data: Raw$l): InvoiceItem;
338
627
  }
339
628
 
340
- type Raw$d = Record<string, unknown>;
629
+ type Raw$k = Record<string, unknown>;
341
630
  declare class InvoiceLink {
342
631
  readonly publicUrl?: string | undefined;
343
632
  readonly token?: string | undefined;
344
633
  constructor(publicUrl?: string | undefined, token?: string | undefined);
345
- static fromRaw(data: Raw$d): InvoiceLink;
634
+ static fromRaw(data: Raw$k): InvoiceLink;
346
635
  }
347
636
 
348
- type Raw$c = Record<string, unknown>;
637
+ type Raw$j = Record<string, unknown>;
349
638
  /**
350
639
  * Invoice endpoints.
351
640
  *
@@ -363,7 +652,7 @@ declare class Invoices extends AbstractResource {
363
652
  *
364
653
  * @param filters `status` — draft | sent | viewed | partially_paid | paid | void | refunded | overdue | all
365
654
  */
366
- list(sid: string, filters?: Raw$c): Promise<CursorPage<Invoice>>;
655
+ list(sid: string, filters?: Raw$j): Promise<CursorPage<Invoice>>;
367
656
  show(sid: string, invoiceId: number | string): Promise<Invoice>;
368
657
  /**
369
658
  * Create a draft invoice with its line items. Every line must reference a
@@ -384,14 +673,14 @@ declare class Invoices extends AbstractResource {
384
673
  * `invoice.coverFeeQuote` for what the customer will actually be charged.
385
674
  * Omitting the field inherits the merchant's invoice setting.
386
675
  */
387
- create(sid: string, attributes: Raw$c): Promise<Invoice>;
676
+ create(sid: string, attributes: Raw$j): Promise<Invoice>;
388
677
  /**
389
678
  * Update a draft invoice. Only drafts can be edited, and passing `lines`
390
679
  * replaces the existing line items.
391
680
  *
392
681
  * @param attributes same shape as {@link Invoices.create}
393
682
  */
394
- update(sid: string, invoiceId: number | string, attributes: Raw$c): Promise<Invoice>;
683
+ update(sid: string, invoiceId: number | string, attributes: Raw$j): Promise<Invoice>;
395
684
  delete(sid: string, invoiceId: number | string): Promise<MessageResult>;
396
685
  /** Email the invoice to the customer and advance it to Sent. */
397
686
  send(sid: string, invoiceId: number | string): Promise<Invoice>;
@@ -418,7 +707,7 @@ declare class Invoices extends AbstractResource {
418
707
  * `invoice.payments`. Card and ACH rates differ, so the same `amount` settles
419
708
  * differently per `payment_type`.
420
709
  */
421
- pay(sid: string, invoiceId: number | string, attributes: Raw$c): Promise<Invoice>;
710
+ pay(sid: string, invoiceId: number | string, attributes: Raw$j): Promise<Invoice>;
422
711
  /** Get the public pay link (and token) for an invoice. */
423
712
  getLink(sid: string, invoiceId: number | string): Promise<InvoiceLink>;
424
713
  /**
@@ -427,14 +716,14 @@ declare class Invoices extends AbstractResource {
427
716
  * @param attributes `item_id`, `name`, `quantity` and `unit_price` are
428
717
  * required; `description` is optional.
429
718
  */
430
- addLineItem(sid: string, invoiceId: number | string, attributes: Raw$c): Promise<Invoice>;
719
+ addLineItem(sid: string, invoiceId: number | string, attributes: Raw$j): Promise<Invoice>;
431
720
  /**
432
721
  * Update a single line item on a draft invoice.
433
722
  *
434
723
  * @param attributes any of `item_id`, `name`, `description`, `quantity`,
435
724
  * `unit_price`
436
725
  */
437
- updateLineItem(sid: string, invoiceId: number | string, lineItemId: number | string, attributes: Raw$c): Promise<Invoice>;
726
+ updateLineItem(sid: string, invoiceId: number | string, lineItemId: number | string, attributes: Raw$j): Promise<Invoice>;
438
727
  /** Remove a single line item from a draft invoice. */
439
728
  deleteLineItem(sid: string, invoiceId: number | string, lineItemId: number | string): Promise<Invoice>;
440
729
  /** List the Merchant's items (funds/designations) available as invoice line items. */
@@ -447,17 +736,43 @@ declare class Invoices extends AbstractResource {
447
736
  * @param attributes `name` is required; `description`, `price` and
448
737
  * `tax_deductible` are optional.
449
738
  */
450
- createItem(sid: string, attributes: Raw$c): Promise<InvoiceItem>;
739
+ createItem(sid: string, attributes: Raw$j): Promise<InvoiceItem>;
451
740
  }
452
741
 
453
- type Raw$b = Record<string, unknown>;
742
+ type Raw$i = Record<string, unknown>;
743
+ /**
744
+ * Where a merchant sits in onboarding.
745
+ *
746
+ * `status` is the headline: `lead`, `discovery`, `proposal`,
747
+ * `application_in_progress`, `underwriting`, `live`, `cancellation_pending`,
748
+ * `churned` or `declined`, or undefined for a merchant that has not started.
749
+ * `applicationStatus` is the application record's own state — `draft`,
750
+ * `pending_review`, `submitted`, `approved`, `needs_documents` or `failed` —
751
+ * and is the field to read while `status` is `underwriting`, since only
752
+ * `needs_documents` asks anything of the merchant.
753
+ *
754
+ * `boarded` is the ground truth for "can they take money": a merchant can be
755
+ * `live` without the application ever reading `approved`.
756
+ */
757
+ declare class ApplicationStatus {
758
+ readonly sid?: string | undefined;
759
+ readonly name?: string | undefined;
760
+ readonly status?: string | undefined;
761
+ readonly applicationStatus?: string | undefined;
762
+ readonly boarded: boolean;
763
+ readonly applicationSubmittedAt?: string | undefined;
764
+ constructor(sid?: string | undefined, name?: string | undefined, status?: string | undefined, applicationStatus?: string | undefined, boarded?: boolean, applicationSubmittedAt?: string | undefined);
765
+ static fromRaw(data: Raw$i): ApplicationStatus;
766
+ }
767
+
768
+ type Raw$h = Record<string, unknown>;
454
769
  declare class FormLink {
455
770
  readonly link?: string | undefined;
456
771
  constructor(link?: string | undefined);
457
- static fromRaw(data: Raw$b): FormLink;
772
+ static fromRaw(data: Raw$h): FormLink;
458
773
  }
459
774
 
460
- type Raw$a = Record<string, unknown>;
775
+ type Raw$g = Record<string, unknown>;
461
776
  declare class Merchant {
462
777
  readonly name?: string | undefined;
463
778
  readonly sid?: string | undefined;
@@ -481,19 +796,25 @@ declare class Merchant {
481
796
  readonly primaryEmail?: string | undefined;
482
797
  readonly primaryName?: string | undefined;
483
798
  constructor(name?: string | undefined, sid?: string | undefined, mcc?: string | undefined, slug?: string | undefined, pubApiKey?: string | undefined, processorMid?: string | undefined, active?: boolean, activeAt?: string | undefined, gPay?: boolean, aPay?: boolean, pciCompliance?: boolean, website?: string | undefined, addr1?: string | undefined, addr2?: string | undefined, city?: string | undefined, state?: string | undefined, zip?: string | undefined, phone?: string | undefined, primaryPhone?: string | undefined, primaryEmail?: string | undefined, primaryName?: string | undefined);
484
- static fromRaw(data: Raw$a): Merchant;
799
+ static fromRaw(data: Raw$g): Merchant;
485
800
  }
486
801
 
487
- type Raw$9 = Record<string, unknown>;
802
+ type Raw$f = Record<string, unknown>;
488
803
  declare class Merchants extends AbstractResource {
489
- list(filters?: Raw$9): Promise<CursorPage<Merchant>>;
804
+ list(filters?: Raw$f): Promise<CursorPage<Merchant>>;
490
805
  show(sid: string): Promise<Merchant>;
491
- create(attributes: Raw$9): Promise<Merchant>;
492
- update(sid: string, attributes: Raw$9): Promise<Merchant>;
806
+ create(attributes: Raw$f): Promise<Merchant>;
807
+ update(sid: string, attributes: Raw$f): Promise<Merchant>;
493
808
  getFormLink(sid: string): Promise<FormLink>;
809
+ /**
810
+ * Where the merchant sits in onboarding — follow up an application sent with
811
+ * {@link Merchants.getFormLink}. Prefer the `application_status_changed`
812
+ * webhook to polling; poll only to reconcile after an outage.
813
+ */
814
+ applicationStatus(sid: string): Promise<ApplicationStatus>;
494
815
  }
495
816
 
496
- type Raw$8 = Record<string, unknown>;
817
+ type Raw$e = Record<string, unknown>;
497
818
  declare class PaymentMethod {
498
819
  readonly id?: number | undefined;
499
820
  readonly type?: string | undefined;
@@ -521,19 +842,19 @@ declare class PaymentMethod {
521
842
  readonly state?: string | undefined;
522
843
  readonly zip?: string | undefined;
523
844
  constructor(id?: number | undefined, type?: string | undefined, token?: string | undefined, firstName?: string | undefined, lastName?: string | undefined, ccNameOnCard?: string | undefined, ccLastFour?: string | undefined, ccExpirationDate?: string | undefined, ccBrand?: string | undefined, achBankAccountName?: string | undefined, achRoutingNumber?: string | undefined, achAccountNumber?: string | undefined, achOwnershipType?: string | undefined, achAccountType?: string | undefined, achBankName?: string | undefined, status?: string | undefined, statusDate?: string | undefined, enabled?: boolean, isDefault?: boolean, addr1?: string | undefined, addr2?: string | undefined, addr3?: string | undefined, city?: string | undefined, state?: string | undefined, zip?: string | undefined);
524
- static fromRaw(data: Raw$8): PaymentMethod;
845
+ static fromRaw(data: Raw$e): PaymentMethod;
525
846
  }
526
847
 
527
- type Raw$7 = Record<string, unknown>;
848
+ type Raw$d = Record<string, unknown>;
528
849
  declare class PaymentMethods extends AbstractResource {
529
- list(sid: string, filters: Raw$7): Promise<CursorPage<PaymentMethod>>;
530
- show(sid: string, paymentMethodId: number | string, filters: Raw$7): Promise<PaymentMethod>;
531
- create(sid: string, attributes: Raw$7): Promise<PaymentMethod>;
532
- update(sid: string, attributes: Raw$7): Promise<PaymentMethod>;
850
+ list(sid: string, filters: Raw$d): Promise<CursorPage<PaymentMethod>>;
851
+ show(sid: string, paymentMethodId: number | string, filters: Raw$d): Promise<PaymentMethod>;
852
+ create(sid: string, attributes: Raw$d): Promise<PaymentMethod>;
853
+ update(sid: string, attributes: Raw$d): Promise<PaymentMethod>;
533
854
  delete(sid: string, paymentMethodId: number | string, uuid: string): Promise<MessageResult>;
534
855
  }
535
856
 
536
- type Raw$6 = Record<string, unknown>;
857
+ type Raw$c = Record<string, unknown>;
537
858
  declare class RecurringInvoice {
538
859
  readonly id?: number | undefined;
539
860
  readonly status?: string | undefined;
@@ -551,10 +872,10 @@ declare class RecurringInvoice {
551
872
  readonly invoices: Invoice[];
552
873
  readonly coverFeeRequired: boolean;
553
874
  constructor(id?: number | undefined, status?: string | undefined, recurrenceSchedule?: string | undefined, paymentTerms?: string | undefined, startDate?: string | undefined, endDate?: string | undefined, nextRunDate?: string | undefined, lastRunDate?: string | undefined, customerName?: string | undefined, thankYouNote?: string | undefined, customer?: InvoiceCustomer, items?: InvoiceLineItem[], upcomingRunDates?: string[], invoices?: Invoice[], coverFeeRequired?: boolean);
554
- static fromRaw(data: Raw$6): RecurringInvoice;
875
+ static fromRaw(data: Raw$c): RecurringInvoice;
555
876
  }
556
877
 
557
- type Raw$5 = Record<string, unknown>;
878
+ type Raw$b = Record<string, unknown>;
558
879
  /**
559
880
  * Recurring-invoice templates, which generate and send an invoice on a schedule.
560
881
  *
@@ -566,7 +887,7 @@ declare class RecurringInvoices extends AbstractResource {
566
887
  *
567
888
  * @param filters `status` — Active | Paused | Cancelled | Completed
568
889
  */
569
- list(sid: string, filters?: Raw$5): Promise<CursorPage<RecurringInvoice>>;
890
+ list(sid: string, filters?: Raw$b): Promise<CursorPage<RecurringInvoice>>;
570
891
  show(sid: string, recurringInvoiceId: number | string): Promise<RecurringInvoice>;
571
892
  /**
572
893
  * Create a recurring-invoice template. When `recurring_start_date` is today the
@@ -583,11 +904,11 @@ declare class RecurringInvoices extends AbstractResource {
583
904
  * `cover_fee_required` makes the customer cover the processing fee on every
584
905
  * invoice this template generates.
585
906
  */
586
- create(sid: string, attributes: Raw$5): Promise<RecurringInvoice>;
907
+ create(sid: string, attributes: Raw$b): Promise<RecurringInvoice>;
587
908
  cancel(sid: string, recurringInvoiceId: number | string): Promise<RecurringInvoice>;
588
909
  }
589
910
 
590
- type Raw$4 = Record<string, unknown>;
911
+ type Raw$a = Record<string, unknown>;
591
912
  declare class RecurringPaymentMethod {
592
913
  readonly id?: number | undefined;
593
914
  readonly type?: string | undefined;
@@ -602,10 +923,10 @@ declare class RecurringPaymentMethod {
602
923
  readonly accountType?: string | undefined;
603
924
  readonly bankName?: string | undefined;
604
925
  constructor(id?: number | undefined, type?: string | undefined, lastFour?: string | undefined, expiration?: string | undefined, zip?: string | undefined, nameOnCard?: string | undefined, bankAccountName?: string | undefined, routingNumber?: string | undefined, accountNumber?: string | undefined, ownershipType?: string | undefined, accountType?: string | undefined, bankName?: string | undefined);
605
- static fromRaw(data: Raw$4): RecurringPaymentMethod;
926
+ static fromRaw(data: Raw$a): RecurringPaymentMethod;
606
927
  }
607
928
 
608
- type Raw$3 = Record<string, unknown>;
929
+ type Raw$9 = Record<string, unknown>;
609
930
  declare class RecurringPayment {
610
931
  readonly id?: number | undefined;
611
932
  readonly name?: string | undefined;
@@ -625,21 +946,174 @@ declare class RecurringPayment {
625
946
  readonly paymentMethod: RecurringPaymentMethod;
626
947
  readonly shippingAddress: TransactionAddress;
627
948
  constructor(id?: number | undefined, name?: string | undefined, amount?: string | undefined, startDate?: string | undefined, endDate?: string | undefined, recurrenceSchedule?: string | undefined, lastRunDate?: string | undefined, lastRunStatus?: string | undefined, lastRunFailedCount?: number | undefined, nextRunDate?: string | undefined, status?: string | undefined, pausedUntilDate?: string | undefined, customerUuid?: string | undefined, cancelledAt?: string | undefined, error?: string | undefined, paymentMethod?: RecurringPaymentMethod, shippingAddress?: TransactionAddress);
628
- static fromRaw(data: Raw$3): RecurringPayment;
949
+ static fromRaw(data: Raw$9): RecurringPayment;
629
950
  }
630
951
 
631
- type Raw$2 = Record<string, unknown>;
952
+ type Raw$8 = Record<string, unknown>;
632
953
  declare class RecurringPayments extends AbstractResource {
633
- list(sid: string, filters?: Raw$2): Promise<CursorPage<RecurringPayment>>;
954
+ list(sid: string, filters?: Raw$8): Promise<CursorPage<RecurringPayment>>;
634
955
  show(sid: string, recurringPaymentId: number | string): Promise<RecurringPayment>;
635
- create(sid: string, attributes: Raw$2): Promise<RecurringPayment>;
636
- edit(sid: string, recurringPaymentId: number | string, attributes: Raw$2): Promise<RecurringPayment>;
956
+ create(sid: string, attributes: Raw$8): Promise<RecurringPayment>;
957
+ edit(sid: string, recurringPaymentId: number | string, attributes: Raw$8): Promise<RecurringPayment>;
637
958
  pause(sid: string, recurringPaymentId: number | string, pauseUntilDate?: string): Promise<RecurringPayment>;
638
959
  cancel(sid: string, recurringPaymentId: number | string): Promise<RecurringPayment>;
639
960
  activate(sid: string, recurringPaymentId: number | string): Promise<RecurringPayment>;
640
961
  delete(sid: string, recurringPaymentId: number | string): Promise<MessageResult>;
641
962
  }
642
963
 
964
+ type Raw$7 = Record<string, unknown>;
965
+ /** The subscription created by subscribing a customer, and its first charge. */
966
+ declare class SubscribeResult {
967
+ readonly subscriptionId?: number | undefined;
968
+ readonly status?: string | undefined;
969
+ readonly nextRunDate?: string | undefined;
970
+ readonly transactionNumber?: string | undefined;
971
+ readonly amount?: string | undefined;
972
+ constructor(subscriptionId?: number | undefined, status?: string | undefined, nextRunDate?: string | undefined, transactionNumber?: string | undefined, amount?: string | undefined);
973
+ static fromRaw(data: Raw$7): SubscribeResult;
974
+ }
975
+
976
+ type Raw$6 = Record<string, unknown>;
977
+ /**
978
+ * A line item on a subscription plan, or the snapshot a subscription took of
979
+ * it when the customer subscribed. `amount` is present on subscriptions only.
980
+ */
981
+ declare class SubscriptionItem {
982
+ readonly name?: string | undefined;
983
+ readonly description?: string | undefined;
984
+ readonly quantity?: string | undefined;
985
+ readonly unitPrice?: string | undefined;
986
+ readonly amount?: string | undefined;
987
+ constructor(name?: string | undefined, description?: string | undefined, quantity?: string | undefined, unitPrice?: string | undefined, amount?: string | undefined);
988
+ static fromRaw(data: Raw$6): SubscriptionItem;
989
+ }
990
+
991
+ type Raw$5 = Record<string, unknown>;
992
+ /**
993
+ * A subscription plan. `status` is `draft`, `active` or `archived`; only an
994
+ * active plan takes new subscribers. `publicUrl` is the plan's hosted
995
+ * subscribe page.
996
+ */
997
+ declare class SubscriptionPlan {
998
+ readonly id?: number | undefined;
999
+ readonly name?: string | undefined;
1000
+ readonly description?: string | undefined;
1001
+ readonly recurrenceSchedule?: string | undefined;
1002
+ readonly status?: string | undefined;
1003
+ readonly subtotal?: string | undefined;
1004
+ readonly total?: string | undefined;
1005
+ readonly token?: string | undefined;
1006
+ readonly publicUrl?: string | undefined;
1007
+ readonly allowPublic: boolean;
1008
+ readonly createdAt?: string | undefined;
1009
+ readonly items: SubscriptionItem[];
1010
+ constructor(id?: number | undefined, name?: string | undefined, description?: string | undefined, recurrenceSchedule?: string | undefined, status?: string | undefined, subtotal?: string | undefined, total?: string | undefined, token?: string | undefined, publicUrl?: string | undefined, allowPublic?: boolean, createdAt?: string | undefined, items?: SubscriptionItem[]);
1011
+ static fromRaw(data: Raw$5): SubscriptionPlan;
1012
+ }
1013
+
1014
+ type Raw$4 = Record<string, unknown>;
1015
+ /**
1016
+ * Subscription plans: a recurring bundle of line items customers subscribe to.
1017
+ *
1018
+ * A plan is created as a `draft`, published to `active` to take subscribers,
1019
+ * and archived to stop new ones. Existing subscribers keep the snapshot they
1020
+ * subscribed to, so editing or archiving a plan never changes them.
1021
+ */
1022
+ declare class SubscriptionPlans extends AbstractResource {
1023
+ /**
1024
+ * List a merchant's plans, newest first.
1025
+ *
1026
+ * @param status `draft`, `active` or `archived`
1027
+ */
1028
+ list(sid: string, status?: string): Promise<CursorPage<SubscriptionPlan>>;
1029
+ show(sid: string, subscriptionPlanId: number | string): Promise<SubscriptionPlan>;
1030
+ /**
1031
+ * Create a plan as a draft. Publish it before customers can subscribe.
1032
+ *
1033
+ * @param attributes
1034
+ * `name`, `recurrence_schedule` (`Weekly` | `Biweekly` | `FirstFifteenth` |
1035
+ * `Monthly` | `Yearly`) and `lines` are required. `lines[]` takes
1036
+ * `item_id` (a Merchant item), `name`, `quantity`, `unit_price` and
1037
+ * optional `description`. Optional: `description`, `allow_public` (list
1038
+ * the plan in the public catalog).
1039
+ */
1040
+ create(sid: string, attributes: Raw$4): Promise<SubscriptionPlan>;
1041
+ /**
1042
+ * Replace a plan's fields and line items wholesale — send the full plan, not
1043
+ * just what changed. Existing subscribers are unaffected.
1044
+ *
1045
+ * @param attributes same shape as {@link SubscriptionPlans.create}
1046
+ */
1047
+ edit(sid: string, subscriptionPlanId: number | string, attributes: Raw$4): Promise<SubscriptionPlan>;
1048
+ /** Delete a plan with no subscribers. A plan that has any must be archived instead. */
1049
+ delete(sid: string, subscriptionPlanId: number | string): Promise<MessageResult>;
1050
+ /** Move a draft plan with at least one line item to active, so customers can subscribe. */
1051
+ publish(sid: string, subscriptionPlanId: number | string): Promise<SubscriptionPlan>;
1052
+ /** Stop new subscriptions and hide the plan from the public catalog. */
1053
+ archive(sid: string, subscriptionPlanId: number | string): Promise<SubscriptionPlan>;
1054
+ /**
1055
+ * Move an archived plan back to draft, to review and re-publish.
1056
+ * `allowPublic` stays off until the merchant opts back into the catalog.
1057
+ */
1058
+ unarchive(sid: string, subscriptionPlanId: number | string): Promise<SubscriptionPlan>;
1059
+ /**
1060
+ * Subscribe a customer to an active plan: charges the first payment to one
1061
+ * of the customer's saved payment methods and enrolls them.
1062
+ */
1063
+ subscribe(sid: string, subscriptionPlanId: number | string, customerUuid: string, paymentMethodId: number | string): Promise<SubscribeResult>;
1064
+ }
1065
+
1066
+ type Raw$3 = Record<string, unknown>;
1067
+ /**
1068
+ * A customer's subscription to a plan. `status` is `Active`, `Failed`,
1069
+ * `Paused`, `Cancelled` or `Ended`.
1070
+ */
1071
+ declare class Subscription {
1072
+ readonly id?: number | undefined;
1073
+ readonly subscriptionPlanId?: number | undefined;
1074
+ readonly planName?: string | undefined;
1075
+ readonly amount?: string | undefined;
1076
+ readonly recurrenceSchedule?: string | undefined;
1077
+ readonly startDate?: string | undefined;
1078
+ readonly endDate?: string | undefined;
1079
+ readonly lastRunDate?: string | undefined;
1080
+ readonly lastRunStatus?: string | undefined;
1081
+ readonly lastRunFailedCount?: number | undefined;
1082
+ readonly nextRunDate?: string | undefined;
1083
+ readonly status?: string | undefined;
1084
+ readonly pausedUntilDate?: string | undefined;
1085
+ readonly cancelledAt?: string | undefined;
1086
+ readonly cancelledBy?: string | undefined;
1087
+ readonly customerUuid?: string | undefined;
1088
+ readonly error?: string | undefined;
1089
+ readonly paymentMethod: RecurringPaymentMethod;
1090
+ readonly items: SubscriptionItem[];
1091
+ constructor(id?: number | undefined, subscriptionPlanId?: number | undefined, planName?: string | undefined, amount?: string | undefined, recurrenceSchedule?: string | undefined, startDate?: string | undefined, endDate?: string | undefined, lastRunDate?: string | undefined, lastRunStatus?: string | undefined, lastRunFailedCount?: number | undefined, nextRunDate?: string | undefined, status?: string | undefined, pausedUntilDate?: string | undefined, cancelledAt?: string | undefined, cancelledBy?: string | undefined, customerUuid?: string | undefined, error?: string | undefined, paymentMethod?: RecurringPaymentMethod, items?: SubscriptionItem[]);
1092
+ static fromRaw(data: Raw$3): Subscription;
1093
+ }
1094
+
1095
+ type Raw$2 = Record<string, unknown>;
1096
+ /** Customers' subscriptions to subscription plans. */
1097
+ declare class Subscriptions extends AbstractResource {
1098
+ /**
1099
+ * List a merchant's subscriptions, newest first.
1100
+ *
1101
+ * @param filters `status` — Active | Failed | Paused | Cancelled | Ended;
1102
+ * `customer_uuid`
1103
+ */
1104
+ list(sid: string, filters?: Raw$2): Promise<CursorPage<Subscription>>;
1105
+ show(sid: string, subscriptionId: number | string): Promise<Subscription>;
1106
+ /**
1107
+ * Pause a subscription until `pauseUntilDate` (Y-m-d, in the future), or
1108
+ * indefinitely when it is omitted.
1109
+ */
1110
+ pause(sid: string, subscriptionId: number | string, pauseUntilDate?: string): Promise<Subscription>;
1111
+ /** Reactivate a paused subscription and recompute its next charge date. */
1112
+ resume(sid: string, subscriptionId: number | string): Promise<Subscription>;
1113
+ /** Cancel a subscription permanently; no further charges are made. */
1114
+ cancel(sid: string, subscriptionId: number | string): Promise<Subscription>;
1115
+ }
1116
+
643
1117
  type Raw$1 = Record<string, unknown>;
644
1118
  declare class TokenizeResult {
645
1119
  readonly token?: string | undefined;
@@ -656,6 +1130,26 @@ declare class Transactions extends AbstractResource {
656
1130
  chargeCardToken(sid: string, attributes: Raw): Promise<Transaction>;
657
1131
  chargeAch(sid: string, attributes: Raw): Promise<Transaction>;
658
1132
  tokenizeCard(sid: string, attributes: Raw): Promise<TokenizeResult>;
1133
+ /**
1134
+ * Place a hold on a card without moving money. Pass a `token` or the raw
1135
+ * card fields, as for {@link Transactions.chargeCard}.
1136
+ *
1137
+ * The returned `transactionNumber` is the handle on the authorization:
1138
+ * collect it with {@link Transactions.capture}, or release the hold with
1139
+ * {@link Transactions.void} (type `CC`). Capture promptly — the issuer
1140
+ * releases an uncaptured hold on its own schedule.
1141
+ */
1142
+ authorize(sid: string, attributes: Raw): Promise<Transaction>;
1143
+ /**
1144
+ * Capture an authorization. Omit `amount` to capture the full authorized
1145
+ * amount, or pass less to capture part of it.
1146
+ *
1147
+ * An authorization is captured once: a partial capture settles that amount
1148
+ * and releases the rest to the cardholder.
1149
+ *
1150
+ * @param transactionId the `transactionNumber` returned by {@link Transactions.authorize}
1151
+ */
1152
+ capture(sid: string, transactionId: number | string, amount?: number | string): Promise<MessageResult>;
659
1153
  refund(sid: string, attributes: Raw): Promise<MessageResult>;
660
1154
  void(sid: string, transactionType: string, transactionId: number | string): Promise<MessageResult>;
661
1155
  }
@@ -681,6 +1175,11 @@ declare class Client {
681
1175
  readonly recurringPayments: RecurringPayments;
682
1176
  readonly invoices: Invoices;
683
1177
  readonly recurringInvoices: RecurringInvoices;
1178
+ readonly chargebacks: Chargebacks;
1179
+ readonly documents: Documents;
1180
+ readonly funds: Funds;
1181
+ readonly subscriptionPlans: SubscriptionPlans;
1182
+ readonly subscriptions: Subscriptions;
684
1183
  private readonly _config;
685
1184
  constructor(token: string | Config, baseUrl?: string);
686
1185
  config(): Config;
@@ -725,4 +1224,4 @@ declare class ServerException extends DimeException {
725
1224
  declare class ConnectionException extends DimeException {
726
1225
  }
727
1226
 
728
- export { Address, ApiException, AuthenticationException, Client, Config, ConnectionException, CoverFeeQuote, CursorPage, Customer, DEFAULT_BASE_URL, Deposit, DepositGroup, DepositWithTransactions, DimeException, FormLink, Invoice, InvoiceCustomer, InvoiceEvent, InvoiceItem, InvoiceLineItem, InvoiceLink, InvoicePayment, Merchant, MessageResult, NotFoundException, PaymentMethod, PermissionDeniedException, RateLimitException, RecurringInvoice, RecurringPayment, RecurringPaymentMethod, ServerException, TokenizeResult, Transaction, TransactionAddress, VERSION, ValidationException };
1227
+ export { Address, ApiException, ApplicationStatus, AuthenticationException, Chargeback, Client, Config, ConnectionException, CoverFeeQuote, CursorPage, Customer, DEFAULT_BASE_URL, Deposit, DepositGroup, DepositWithTransactions, DimeException, type DocumentFile, DocumentUploadFailure, DocumentUploadResult, FormLink, FundRelease, FundReleaseResult, HeldBalance, Invoice, InvoiceCustomer, InvoiceEvent, InvoiceItem, InvoiceLineItem, InvoiceLink, InvoicePayment, Merchant, MerchantDocument, MessageResult, NotFoundException, PaymentMethod, PermissionDeniedException, RateLimitException, RecurringInvoice, RecurringPayment, RecurringPaymentMethod, ReleasableTransaction, ReleasableTransactions, ServerException, SubscribeResult, Subscription, SubscriptionItem, SubscriptionPlan, TokenizeResult, Transaction, TransactionAddress, VERSION, ValidationException };