@spritz-finance/api-client 0.4.8 → 0.4.10
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 +39 -28
- package/dist/spritz-api-client.cjs +55 -56
- package/dist/spritz-api-client.d.ts +6 -10
- package/dist/spritz-api-client.mjs +55 -56
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -50,7 +50,6 @@ client.setApiKey(user.apiKey)
|
|
|
50
50
|
const bankAccount = await client.bankAccount.create(BankAccountType.USBankAccount, {
|
|
51
51
|
accountNumber: '123456789',
|
|
52
52
|
routingNumber: '987654321',
|
|
53
|
-
holder: 'John Doe',
|
|
54
53
|
name: 'My Checking Account',
|
|
55
54
|
ownedByUser: true,
|
|
56
55
|
subType: BankAccountSubType.Checking,
|
|
@@ -352,7 +351,6 @@ const bankAccounts = [{
|
|
|
352
351
|
country: "US",
|
|
353
352
|
currency: "USD",
|
|
354
353
|
email: "bilbo@shiremail.net",
|
|
355
|
-
holder: "Bilbo Baggins",
|
|
356
354
|
institution: {
|
|
357
355
|
id: "62d27d4b277dab3c1342126e",
|
|
358
356
|
name: "Shire Bank",
|
|
@@ -374,9 +372,8 @@ The input structure for adding a US bank account is defined as:
|
|
|
374
372
|
// Input arguments for creating a US bank account
|
|
375
373
|
export interface USBankAccountInput {
|
|
376
374
|
accountNumber: string
|
|
377
|
-
email
|
|
378
|
-
|
|
379
|
-
name: string
|
|
375
|
+
email?: string | null
|
|
376
|
+
name?: string | null
|
|
380
377
|
ownedByUser?: boolean | null
|
|
381
378
|
routingNumber: string
|
|
382
379
|
subType: BankAccountSubType
|
|
@@ -389,7 +386,6 @@ import { BankAccountType, BankAccountSubType } from '@spritz-finance/api-client'
|
|
|
389
386
|
const bankAccounts = await client.bankAccount.create(BankAccountType.USBankAccount, {
|
|
390
387
|
accountNumber: '123456789',
|
|
391
388
|
routingNumber: '987654321',
|
|
392
|
-
holder: 'Bilbo Baggins',
|
|
393
389
|
name: 'Precious Savings',
|
|
394
390
|
ownedByUser: true,
|
|
395
391
|
subType: BankAccountSubType.Savings,
|
|
@@ -407,7 +403,6 @@ The input structure for adding a Canadian bank account is defined as:
|
|
|
407
403
|
export interface CABankAccountInput {
|
|
408
404
|
accountNumber: string
|
|
409
405
|
email?: string
|
|
410
|
-
holder: string
|
|
411
406
|
name: string
|
|
412
407
|
ownedByUser?: boolean | null
|
|
413
408
|
transitNumber: string
|
|
@@ -423,7 +418,6 @@ const bankAccounts = await client.bankAccount.create(BankAccountType.CABankAccou
|
|
|
423
418
|
accountNumber: '123456789',
|
|
424
419
|
transitNumber: '12345',
|
|
425
420
|
institutionNumber: '123',
|
|
426
|
-
holder: 'Bilbo Baggins',
|
|
427
421
|
name: 'Precious Savings',
|
|
428
422
|
ownedByUser: true,
|
|
429
423
|
subType: BankAccountSubType.Savings,
|
|
@@ -445,22 +439,24 @@ const debitCards = await client.debitCard.list()
|
|
|
445
439
|
The `debitCard.list()` method returns an array of user-linked debit cards:
|
|
446
440
|
|
|
447
441
|
```typescript
|
|
448
|
-
const debitCards = [
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
442
|
+
const debitCards = [
|
|
443
|
+
{
|
|
444
|
+
id: '62d17d3b377dab6c1342136e',
|
|
445
|
+
type: 'DebitCard',
|
|
446
|
+
name: 'My Visa Debit',
|
|
447
|
+
userId: '62d17d3b377dab6c1342136e',
|
|
448
|
+
country: 'US',
|
|
449
|
+
currency: 'USD',
|
|
450
|
+
payable: true,
|
|
451
|
+
debitCardNetwork: 'Visa',
|
|
452
|
+
expirationDate: '12/25',
|
|
453
|
+
cardNumber: '4111111111111111',
|
|
454
|
+
mask: '1111',
|
|
455
|
+
createdAt: '2023-01-01T00:00:00Z',
|
|
456
|
+
paymentCount: 5,
|
|
457
|
+
externalId: 'ext-123',
|
|
458
|
+
},
|
|
459
|
+
]
|
|
464
460
|
```
|
|
465
461
|
|
|
466
462
|
#### Add a debit card
|
|
@@ -481,13 +477,14 @@ The input structure for adding a debit card is:
|
|
|
481
477
|
|
|
482
478
|
```typescript
|
|
483
479
|
export interface DebitCardInput {
|
|
484
|
-
name?: string | null
|
|
485
|
-
cardNumber: string
|
|
486
|
-
expirationDate: string
|
|
480
|
+
name?: string | null // Optional name for the card
|
|
481
|
+
cardNumber: string // Full card number (13-19 digits)
|
|
482
|
+
expirationDate: string // Expiration date in MM/YY format
|
|
487
483
|
}
|
|
488
484
|
```
|
|
489
485
|
|
|
490
486
|
Supported debit card networks:
|
|
487
|
+
|
|
491
488
|
- `Visa`
|
|
492
489
|
- `Mastercard`
|
|
493
490
|
|
|
@@ -658,7 +655,10 @@ const updateAccount = await client.bankAccount.rename('62d17d3b377dab6c1342136e'
|
|
|
658
655
|
You can change the display name of a debit card:
|
|
659
656
|
|
|
660
657
|
```typescript
|
|
661
|
-
const updatedCard = await client.debitCard.rename(
|
|
658
|
+
const updatedCard = await client.debitCard.rename(
|
|
659
|
+
'62d17d3b377dab6c1342136e',
|
|
660
|
+
'My primary debit card'
|
|
661
|
+
)
|
|
662
662
|
```
|
|
663
663
|
|
|
664
664
|
#### Rename a bill
|
|
@@ -1023,3 +1023,14 @@ const signature = createHmac("sha256", <YOUR_WEBHOOK_SECRET>)
|
|
|
1023
1023
|
```
|
|
1024
1024
|
|
|
1025
1025
|
Ensure that the computed signature matches the Signature header received in the webhook request before processing the payload.
|
|
1026
|
+
|
|
1027
|
+
### Setting webhook secret
|
|
1028
|
+
|
|
1029
|
+
To add or update a webhook secret for signing webhook requests:
|
|
1030
|
+
|
|
1031
|
+
```typescript
|
|
1032
|
+
const result = await client.webhook.updateWebhookSecret('your-webhook-secret-here')
|
|
1033
|
+
// Returns: { success: true }
|
|
1034
|
+
```
|
|
1035
|
+
|
|
1036
|
+
This secret will be used to sign all subsequent webhook requests sent to your endpoint. Always store your webhook secret securely and never expose it in client-side code.
|