@spritz-finance/api-client 0.4.9 → 0.4.11
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 +41 -30
- package/dist/spritz-api-client.cjs +57 -58
- package/dist/spritz-api-client.d.ts +7 -6
- package/dist/spritz-api-client.mjs +57 -58
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
BankAccountType,
|
|
31
31
|
BankAccountSubType,
|
|
32
32
|
DebitCardNetwork,
|
|
33
|
+
AmountMode,
|
|
33
34
|
} from '@spritz-finance/api-client'
|
|
34
35
|
|
|
35
36
|
// Initialize the client with your integration key
|
|
@@ -50,7 +51,6 @@ client.setApiKey(user.apiKey)
|
|
|
50
51
|
const bankAccount = await client.bankAccount.create(BankAccountType.USBankAccount, {
|
|
51
52
|
accountNumber: '123456789',
|
|
52
53
|
routingNumber: '987654321',
|
|
53
|
-
holder: 'John Doe',
|
|
54
54
|
name: 'My Checking Account',
|
|
55
55
|
ownedByUser: true,
|
|
56
56
|
subType: BankAccountSubType.Checking,
|
|
@@ -352,7 +352,6 @@ const bankAccounts = [{
|
|
|
352
352
|
country: "US",
|
|
353
353
|
currency: "USD",
|
|
354
354
|
email: "bilbo@shiremail.net",
|
|
355
|
-
holder: "Bilbo Baggins",
|
|
356
355
|
institution: {
|
|
357
356
|
id: "62d27d4b277dab3c1342126e",
|
|
358
357
|
name: "Shire Bank",
|
|
@@ -374,9 +373,8 @@ The input structure for adding a US bank account is defined as:
|
|
|
374
373
|
// Input arguments for creating a US bank account
|
|
375
374
|
export interface USBankAccountInput {
|
|
376
375
|
accountNumber: string
|
|
377
|
-
email
|
|
378
|
-
|
|
379
|
-
name: string
|
|
376
|
+
email?: string | null
|
|
377
|
+
name?: string | null
|
|
380
378
|
ownedByUser?: boolean | null
|
|
381
379
|
routingNumber: string
|
|
382
380
|
subType: BankAccountSubType
|
|
@@ -389,7 +387,6 @@ import { BankAccountType, BankAccountSubType } from '@spritz-finance/api-client'
|
|
|
389
387
|
const bankAccounts = await client.bankAccount.create(BankAccountType.USBankAccount, {
|
|
390
388
|
accountNumber: '123456789',
|
|
391
389
|
routingNumber: '987654321',
|
|
392
|
-
holder: 'Bilbo Baggins',
|
|
393
390
|
name: 'Precious Savings',
|
|
394
391
|
ownedByUser: true,
|
|
395
392
|
subType: BankAccountSubType.Savings,
|
|
@@ -407,7 +404,6 @@ The input structure for adding a Canadian bank account is defined as:
|
|
|
407
404
|
export interface CABankAccountInput {
|
|
408
405
|
accountNumber: string
|
|
409
406
|
email?: string
|
|
410
|
-
holder: string
|
|
411
407
|
name: string
|
|
412
408
|
ownedByUser?: boolean | null
|
|
413
409
|
transitNumber: string
|
|
@@ -423,7 +419,6 @@ const bankAccounts = await client.bankAccount.create(BankAccountType.CABankAccou
|
|
|
423
419
|
accountNumber: '123456789',
|
|
424
420
|
transitNumber: '12345',
|
|
425
421
|
institutionNumber: '123',
|
|
426
|
-
holder: 'Bilbo Baggins',
|
|
427
422
|
name: 'Precious Savings',
|
|
428
423
|
ownedByUser: true,
|
|
429
424
|
subType: BankAccountSubType.Savings,
|
|
@@ -445,22 +440,24 @@ const debitCards = await client.debitCard.list()
|
|
|
445
440
|
The `debitCard.list()` method returns an array of user-linked debit cards:
|
|
446
441
|
|
|
447
442
|
```typescript
|
|
448
|
-
const debitCards = [
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
443
|
+
const debitCards = [
|
|
444
|
+
{
|
|
445
|
+
id: '62d17d3b377dab6c1342136e',
|
|
446
|
+
type: 'DebitCard',
|
|
447
|
+
name: 'My Visa Debit',
|
|
448
|
+
userId: '62d17d3b377dab6c1342136e',
|
|
449
|
+
country: 'US',
|
|
450
|
+
currency: 'USD',
|
|
451
|
+
payable: true,
|
|
452
|
+
debitCardNetwork: 'Visa',
|
|
453
|
+
expirationDate: '12/25',
|
|
454
|
+
cardNumber: '4111111111111111',
|
|
455
|
+
mask: '1111',
|
|
456
|
+
createdAt: '2023-01-01T00:00:00Z',
|
|
457
|
+
paymentCount: 5,
|
|
458
|
+
externalId: 'ext-123',
|
|
459
|
+
},
|
|
460
|
+
]
|
|
464
461
|
```
|
|
465
462
|
|
|
466
463
|
#### Add a debit card
|
|
@@ -481,13 +478,14 @@ The input structure for adding a debit card is:
|
|
|
481
478
|
|
|
482
479
|
```typescript
|
|
483
480
|
export interface DebitCardInput {
|
|
484
|
-
name?: string | null
|
|
485
|
-
cardNumber: string
|
|
486
|
-
expirationDate: string
|
|
481
|
+
name?: string | null // Optional name for the card
|
|
482
|
+
cardNumber: string // Full card number (13-19 digits)
|
|
483
|
+
expirationDate: string // Expiration date in MM/YY format
|
|
487
484
|
}
|
|
488
485
|
```
|
|
489
486
|
|
|
490
487
|
Supported debit card networks:
|
|
488
|
+
|
|
491
489
|
- `Visa`
|
|
492
490
|
- `Mastercard`
|
|
493
491
|
|
|
@@ -658,7 +656,10 @@ const updateAccount = await client.bankAccount.rename('62d17d3b377dab6c1342136e'
|
|
|
658
656
|
You can change the display name of a debit card:
|
|
659
657
|
|
|
660
658
|
```typescript
|
|
661
|
-
const updatedCard = await client.debitCard.rename(
|
|
659
|
+
const updatedCard = await client.debitCard.rename(
|
|
660
|
+
'62d17d3b377dab6c1342136e',
|
|
661
|
+
'My primary debit card'
|
|
662
|
+
)
|
|
662
663
|
```
|
|
663
664
|
|
|
664
665
|
#### Rename a bill
|
|
@@ -730,14 +731,24 @@ A payment request refers to the intent to initiate a payment to a specific accou
|
|
|
730
731
|
|
|
731
732
|
To initiate a payment request for a specific account, you can use the following functionality. The required inputs for creating a payment request include the ID of the account to be paid, the amount of the fiat payment in USD, and the network on which the blockchain transaction will settle.
|
|
732
733
|
|
|
734
|
+
#### Amount Mode
|
|
735
|
+
|
|
736
|
+
When creating a payment request, you can specify how the amount should be calculated using the `amountMode` parameter:
|
|
737
|
+
|
|
738
|
+
- **`TOTAL_AMOUNT`**: The payer covers the entire amount including fees. The specified amount is the total that will be deducted from the payer's wallet.
|
|
739
|
+
- **`AMOUNT_RECEIVED`** (default): The payment that arrives in the bank account excludes fees. The specified amount is what the recipient will receive, and fees are added on top.
|
|
740
|
+
|
|
741
|
+
This allows you to control whether fees are included in or added to the specified amount.
|
|
742
|
+
|
|
733
743
|
```typescript
|
|
734
|
-
import {PaymentNetwork} from '@spritz-finance/api-client';
|
|
744
|
+
import {PaymentNetwork, AmountMode} from '@spritz-finance/api-client';
|
|
735
745
|
|
|
736
746
|
const paymentRequest = await client.paymentRequest.create({
|
|
737
747
|
amount: 100,
|
|
738
748
|
accountId: account.id,
|
|
739
749
|
network: PaymentNetwork.Ethereum,
|
|
740
|
-
deliveryMethod: 'INSTANT'
|
|
750
|
+
deliveryMethod: 'INSTANT',
|
|
751
|
+
amountMode: AmountMode.TOTAL_AMOUNT // Optional, defaults to AMOUNT_RECEIVED
|
|
741
752
|
});
|
|
742
753
|
|
|
743
754
|
// Example response
|