@spritz-finance/api-client 0.4.6 → 0.4.7
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 +83 -3
- package/dist/spritz-api-client.cjs +125 -67
- package/dist/spritz-api-client.d.ts +121 -2
- package/dist/spritz-api-client.mjs +125 -67
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
PaymentNetwork,
|
|
30
30
|
BankAccountType,
|
|
31
31
|
BankAccountSubType,
|
|
32
|
+
DebitCardNetwork,
|
|
32
33
|
} from '@spritz-finance/api-client'
|
|
33
34
|
|
|
34
35
|
// Initialize the client with your integration key
|
|
@@ -93,6 +94,7 @@ const transactionData = await client.paymentRequest.getWeb3PaymentParams({
|
|
|
93
94
|
- [Account Types](#account-types)
|
|
94
95
|
- [Commonalities & Differences](#commonalities---differences)
|
|
95
96
|
- [Bank Accounts](#bank-accounts)
|
|
97
|
+
- [Debit Cards](#debit-cards)
|
|
96
98
|
- [Bills](#bills)
|
|
97
99
|
- [Virtual Card](#virtual-card)
|
|
98
100
|
- [Address Book](#address-book)
|
|
@@ -305,11 +307,12 @@ Spritz emphasizes its capabilities in account handling and payment processing.
|
|
|
305
307
|
|
|
306
308
|
### Account Types
|
|
307
309
|
|
|
308
|
-
Spritz supports
|
|
310
|
+
Spritz supports four distinct types of accounts:
|
|
309
311
|
|
|
310
312
|
1. **Bank Account**
|
|
311
|
-
2. **
|
|
312
|
-
3. **
|
|
313
|
+
2. **Debit Card**
|
|
314
|
+
3. **Bill**
|
|
315
|
+
4. **Virtual Card**
|
|
313
316
|
|
|
314
317
|
Though each account type possesses its unique creation process and specific properties, it's important to understand that all of them are uniformly termed as an "account" within the Spritz platform.
|
|
315
318
|
|
|
@@ -427,6 +430,67 @@ const bankAccounts = await client.bankAccount.create(BankAccountType.CABankAccou
|
|
|
427
430
|
})
|
|
428
431
|
```
|
|
429
432
|
|
|
433
|
+
### Debit Cards
|
|
434
|
+
|
|
435
|
+
Spritz provides support for adding debit cards as payment accounts, allowing users to make payments directly to their debit cards.
|
|
436
|
+
|
|
437
|
+
#### List user debit cards
|
|
438
|
+
|
|
439
|
+
To retrieve all debit cards linked to a user:
|
|
440
|
+
|
|
441
|
+
```typescript
|
|
442
|
+
const debitCards = await client.debitCard.list()
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
The `debitCard.list()` method returns an array of user-linked debit cards:
|
|
446
|
+
|
|
447
|
+
```typescript
|
|
448
|
+
const debitCards = [{
|
|
449
|
+
id: "62d17d3b377dab6c1342136e",
|
|
450
|
+
type: "DebitCard",
|
|
451
|
+
name: "My Visa Debit",
|
|
452
|
+
userId: "62d17d3b377dab6c1342136e",
|
|
453
|
+
country: "US",
|
|
454
|
+
currency: "USD",
|
|
455
|
+
payable: true,
|
|
456
|
+
debitCardNetwork: "Visa",
|
|
457
|
+
expirationDate: "12/25",
|
|
458
|
+
cardNumber: "4111111111111111",
|
|
459
|
+
mask: "1111",
|
|
460
|
+
createdAt: "2023-01-01T00:00:00Z",
|
|
461
|
+
paymentCount: 5,
|
|
462
|
+
externalId: "ext-123"
|
|
463
|
+
}]
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
#### Add a debit card
|
|
467
|
+
|
|
468
|
+
To add a new debit card for a user:
|
|
469
|
+
|
|
470
|
+
```typescript
|
|
471
|
+
import { DebitCardNetwork } from '@spritz-finance/api-client'
|
|
472
|
+
|
|
473
|
+
const debitCard = await client.debitCard.create({
|
|
474
|
+
name: 'My Visa Debit',
|
|
475
|
+
cardNumber: '4111111111111111',
|
|
476
|
+
expirationDate: '12/25',
|
|
477
|
+
})
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
The input structure for adding a debit card is:
|
|
481
|
+
|
|
482
|
+
```typescript
|
|
483
|
+
export interface DebitCardInput {
|
|
484
|
+
name?: string | null // Optional name for the card
|
|
485
|
+
cardNumber: string // Full card number (13-19 digits)
|
|
486
|
+
expirationDate: string // Expiration date in MM/YY format
|
|
487
|
+
}
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
Supported debit card networks:
|
|
491
|
+
- `Visa`
|
|
492
|
+
- `Mastercard`
|
|
493
|
+
|
|
430
494
|
### Bills
|
|
431
495
|
|
|
432
496
|
Spritz provides robust support for bills, allowing seamless management and interaction with user billing accounts. Below is a guide to the methods and functionalities specifically designed for handling bills within Spritz.
|
|
@@ -589,6 +653,14 @@ You can conveniently change the display name of a bank account using the followi
|
|
|
589
653
|
const updateAccount = await client.bankAccount.rename('62d17d3b377dab6c1342136e', 'My new account')
|
|
590
654
|
```
|
|
591
655
|
|
|
656
|
+
#### Rename a debit card
|
|
657
|
+
|
|
658
|
+
You can change the display name of a debit card:
|
|
659
|
+
|
|
660
|
+
```typescript
|
|
661
|
+
const updatedCard = await client.debitCard.rename('62d17d3b377dab6c1342136e', 'My primary debit card')
|
|
662
|
+
```
|
|
663
|
+
|
|
592
664
|
#### Rename a bill
|
|
593
665
|
|
|
594
666
|
You can conveniently change the display name of a bill using the following endpoint. The first argument specifies the ID of the bill, while the second argument represents the desired new name for the account.
|
|
@@ -607,6 +679,14 @@ To remove a bank account from a user's account, you can use the following endpoi
|
|
|
607
679
|
await client.bankAccount.delete('62d17d3b377dab6c1342136e')
|
|
608
680
|
```
|
|
609
681
|
|
|
682
|
+
#### Delete a debit card
|
|
683
|
+
|
|
684
|
+
To remove a debit card from a user's account:
|
|
685
|
+
|
|
686
|
+
```typescript
|
|
687
|
+
await client.debitCard.delete('62d17d3b377dab6c1342136e')
|
|
688
|
+
```
|
|
689
|
+
|
|
610
690
|
#### Delete a bill
|
|
611
691
|
|
|
612
692
|
To remove a bill from a user's account, you can use the following endpoint. You only need to specify the ID of the bill that you want to delete as an argument.
|