@spritz-finance/api-client 0.1.5 → 0.1.6
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 +269 -157
- package/dist/spritz-api-client.d.ts +1 -1
- package/dist/spritz-api-client.js +43 -43
- package/dist/spritz-api-client.mjs +43 -43
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -18,6 +18,76 @@ A Typescript library for interacting with the Spritz Finance API
|
|
|
18
18
|
yarn add @spritz-finance/api-client
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
+
## Table of contents
|
|
22
|
+
|
|
23
|
+
- [Interacting with the Spritz API](#interacting-with-the-spritz-api)
|
|
24
|
+
- [Creating a user](#creating-a-user)
|
|
25
|
+
- [Capabilities of the API Key:](#capabilities-of-the-api-key-)
|
|
26
|
+
- [Usage](#usage)
|
|
27
|
+
- [Creating a user](#creating-a-user-1)
|
|
28
|
+
- [Setting the User API Key](#setting-the-user-api-key)
|
|
29
|
+
- [Basic User Data](#basic-user-data)
|
|
30
|
+
- [User Verification](#user-verification)
|
|
31
|
+
- [Overview](#overview)
|
|
32
|
+
- [Process](#process)
|
|
33
|
+
- [How to Present Verification Flow to the User](#how-to-present-verification-flow-to-the-user)
|
|
34
|
+
- [Basic payment flow](#basic-payment-flow)
|
|
35
|
+
- [Note on Issuing the Blockchain Transaction](#note-on-issuing-the-blockchain-transaction)
|
|
36
|
+
- [Example](#example)
|
|
37
|
+
- [Accounts](#accounts)
|
|
38
|
+
- [Account Types](#account-types)
|
|
39
|
+
- [Commonalities & Differences](#commonalities---differences)
|
|
40
|
+
- [Bank Accounts](#bank-accounts)
|
|
41
|
+
- [List user bank accounts](#list-user-bank-accounts)
|
|
42
|
+
- [Add US bank account](#add-us-bank-account)
|
|
43
|
+
- [Bills](#bills)
|
|
44
|
+
- [List user bills](#list-user-bills)
|
|
45
|
+
- [Add US bill account](#add-us-bill-account)
|
|
46
|
+
- [Virtual Card](#virtual-card)
|
|
47
|
+
- [Fetch a users virtual card](#fetch-a-users-virtual-card)
|
|
48
|
+
- [Create a US virtual debit card](#create-a-us-virtual-debit-card)
|
|
49
|
+
- [Displaying sensitive card details](#displaying-sensitive-card-details)
|
|
50
|
+
- [Renaming accounts](#renaming-accounts)
|
|
51
|
+
- [Rename a bank account](#rename-a-bank-account)
|
|
52
|
+
- [Rename a bill](#rename-a-bill)
|
|
53
|
+
- [Deleting accounts](#deleting-accounts)
|
|
54
|
+
- [Delete a bank account](#delete-a-bank-account)
|
|
55
|
+
- [Delete a bill](#delete-a-bill)
|
|
56
|
+
- [Bill Institutions](#bill-institutions)
|
|
57
|
+
- [Fetching popular bill institutions](#fetching-popular-bill-institutions)
|
|
58
|
+
- [Searching for bill institutions by name](#searching-for-bill-institutions-by-name)
|
|
59
|
+
- [Payment Requests](#payment-requests)
|
|
60
|
+
- [Create a payment request](#create-a-payment-request)
|
|
61
|
+
- [Fulfil a payment request (EVM transactions)](#fulfil-a-payment-request--evm-transactions-)
|
|
62
|
+
- [Transaction fees](#transaction-fees)
|
|
63
|
+
- [Payments](#payments)
|
|
64
|
+
- [Retrieve the payment for a payment request](#retrieve-the-payment-for-a-payment-request)
|
|
65
|
+
- [Retrieve all payments for an account](#retrieve-all-payments-for-an-account)
|
|
66
|
+
|
|
67
|
+
## Interacting with the Spritz API
|
|
68
|
+
|
|
69
|
+
**Purpose**: As an integrator, this guide will assist you in creating users and performing user-specific operations on the Spritz platform using the provided API key.
|
|
70
|
+
|
|
71
|
+
### Creating a user
|
|
72
|
+
|
|
73
|
+
When you create a user using your integration key:
|
|
74
|
+
|
|
75
|
+
- You will receive an `API key` specific to that user.
|
|
76
|
+
- This enables you to interact with the Spritz platform on the user's behalf.
|
|
77
|
+
|
|
78
|
+
### Capabilities of the API Key:
|
|
79
|
+
|
|
80
|
+
Using the user-specific API key, you can:
|
|
81
|
+
|
|
82
|
+
1. **Identity Verification**: Guide a user through the identity verification process.
|
|
83
|
+
2. **Account Addition**:
|
|
84
|
+
- Add Bills for the user.
|
|
85
|
+
- Register Bank accounts.
|
|
86
|
+
- Issue Virtual cards.
|
|
87
|
+
3. **Payment Requests**: Initiate payment requests to the aforementioned accounts.
|
|
88
|
+
4. **Blockchain Transactions**: Issue blockchain-based transactions to fulfill the payment requests.
|
|
89
|
+
5. **Payment Status**: Query the status of payments directed to the user's accounts.
|
|
90
|
+
|
|
21
91
|
## Usage
|
|
22
92
|
|
|
23
93
|
Your integration key is provided by Spritz and must always be provided.
|
|
@@ -34,23 +104,26 @@ const client = SpritzApiClient.initialize({
|
|
|
34
104
|
})
|
|
35
105
|
```
|
|
36
106
|
|
|
37
|
-
##
|
|
107
|
+
## Creating a user
|
|
38
108
|
|
|
39
|
-
|
|
109
|
+
To create a new Spritz user, all you need is the user's email address. Note that trying to create a user with an email that already exists in the Spritz platform will throw an error.
|
|
40
110
|
|
|
41
111
|
```typescript
|
|
42
112
|
const user = await client.user.create({
|
|
43
113
|
email: 'bilbo@shiremail.net',
|
|
44
114
|
})
|
|
45
115
|
|
|
46
|
-
//
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
116
|
+
// Response
|
|
117
|
+
user = {
|
|
118
|
+
email: "bilbo@shiremail.net"
|
|
119
|
+
userId: "62d17d3b377dab6c1342136e",
|
|
120
|
+
apiKey: "ak_ZTBGDcjfdTg3NmYtZDJlZC00ZjYyLThlMDMtZmYwNDJiZDRlMWZm"
|
|
121
|
+
}
|
|
51
122
|
```
|
|
52
123
|
|
|
53
|
-
|
|
124
|
+
### Setting the User API Key
|
|
125
|
+
|
|
126
|
+
After creating a user, you can easily set the user's API key onto your initialized client using the provided method:
|
|
54
127
|
|
|
55
128
|
```typescript
|
|
56
129
|
client.setApiKey(user.apiKey)
|
|
@@ -68,8 +141,29 @@ const userData = await client.user.getCurrentUser()
|
|
|
68
141
|
|
|
69
142
|
## User Verification
|
|
70
143
|
|
|
71
|
-
|
|
72
|
-
|
|
144
|
+
**Purpose**: To ensure users are properly identified before interacting with the Spritz platform.
|
|
145
|
+
|
|
146
|
+
### Overview
|
|
147
|
+
|
|
148
|
+
All users must undergo basic identity verification before they can engage with the Spritz platform's features.
|
|
149
|
+
|
|
150
|
+
### Process
|
|
151
|
+
|
|
152
|
+
1. **User Creation**: Upon the creation of a new user, their default verification status will be set to `INITIALIZED`.
|
|
153
|
+
|
|
154
|
+
2. **Checking Verification Status**: Use the `getUserVerification` method to retrieve the current verification status of a user.
|
|
155
|
+
3. **Verification Transition**: Once a user completes the identity verification process, their status will change from `INITIALIZED` to `ACTIVE`. Only then can the user fully interact with the platform.
|
|
156
|
+
|
|
157
|
+
4. **Getting Verification URL**: When you request a user's verification status, the response will provide a `verificationUrl`. This URL is essential for the user to proceed with their identity verification.
|
|
158
|
+
|
|
159
|
+
### How to Present Verification Flow to the User
|
|
160
|
+
|
|
161
|
+
Here are some options on how you can present the `verificationUrl` to the user:
|
|
162
|
+
|
|
163
|
+
- **Browser**: Open the URL in a new browser tab.
|
|
164
|
+
- **In-App**: Embed the URL in an iframe within your application.
|
|
165
|
+
- **Mobile**: If your platform is mobile-based, open the URL in a native mobile web view.
|
|
166
|
+
- **Email**: Send users an email containing the link, prompting them to complete the identity verification.
|
|
73
167
|
|
|
74
168
|
```typescript
|
|
75
169
|
const verificationData = await client.user.getUserVerification()
|
|
@@ -77,6 +171,29 @@ const verificationData = await client.user.getUserVerification()
|
|
|
77
171
|
|
|
78
172
|
## Basic payment flow
|
|
79
173
|
|
|
174
|
+
Execute a payment in a few simple steps:
|
|
175
|
+
|
|
176
|
+
1. **Select an Account**: Choose the account you wish to pay to.
|
|
177
|
+
2. **Initiate Payment Request**: Use the account's ID, your desired payment amount, and the chosen blockchain network to create a payment request.
|
|
178
|
+
3. **Retrieve Transaction Data**: Use the `getWeb3PaymentParams` method to obtain the necessary transaction data for fulfilling the payment request.
|
|
179
|
+
4. **Blockchain Transaction**: Issue the required blockchain transaction from the user's wallet.
|
|
180
|
+
5. **Payment Confirmation**: After blockchain transaction confirmation, check the status of the TradFi payment.
|
|
181
|
+
|
|
182
|
+
### Note on Issuing the Blockchain Transaction
|
|
183
|
+
|
|
184
|
+
For Spritz to process a TradFi payment to an account, we need to receive a blockchain transaction on our smart contract, which provides us the crypto funds. As an integrator, it's essential to manage how the blockchain transaction is initiated from the user's wallet to Spritz.
|
|
185
|
+
|
|
186
|
+
- **Wallet Apps**: If your application functions as a wallet, prompt the user to sign a transaction using data from `getWeb3PaymentParams`.
|
|
187
|
+
- **Web-based Dapps**: Use your existing connection to the user's wallet to prompt a transaction.
|
|
188
|
+
|
|
189
|
+
If your application doesn't have a connection to the user's wallet, consider implementing one. Some popular options include:
|
|
190
|
+
|
|
191
|
+
- [Web3Modal (Web-based)](https://github.com/WalletConnect/web3modal)
|
|
192
|
+
- [Web3Modal (React Native)](https://github.com/WalletConnect/modal-react-native)
|
|
193
|
+
- [Web3-Onboard](https://onboard.blocknative.com/docs/overview/introduction#features)
|
|
194
|
+
|
|
195
|
+
### Example
|
|
196
|
+
|
|
80
197
|
```typescript
|
|
81
198
|
// Fetch all bank accounts for the user
|
|
82
199
|
const bankAccounts = await client.bankAccount.list()
|
|
@@ -106,21 +223,40 @@ const transactionData = await client.paymentRequest.getWeb3PaymentParams({
|
|
|
106
223
|
const payment = await client.payment.getForPaymentRequest(paymentRequest.id)
|
|
107
224
|
```
|
|
108
225
|
|
|
109
|
-
##
|
|
226
|
+
## Accounts
|
|
227
|
+
|
|
228
|
+
Spritz emphasizes its capabilities in account handling and payment processing.
|
|
229
|
+
|
|
230
|
+
### Account Types
|
|
110
231
|
|
|
111
|
-
Spritz
|
|
232
|
+
Spritz supports three distinct types of accounts:
|
|
112
233
|
|
|
113
|
-
|
|
234
|
+
1. **Bank Account**
|
|
235
|
+
2. **Bill**
|
|
236
|
+
3. **Virtual Card**
|
|
114
237
|
|
|
115
|
-
|
|
238
|
+
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.
|
|
239
|
+
|
|
240
|
+
### Commonalities & Differences
|
|
241
|
+
|
|
242
|
+
- **Common Properties**: Every type of account shares certain properties consistent across the platform.
|
|
243
|
+
- **Unique Properties**: Each account type also has attributes specific to its nature and functionality.
|
|
244
|
+
|
|
245
|
+
Recognizing these nuances is crucial for optimal interaction with the Spritz platform's account-related features.
|
|
246
|
+
|
|
247
|
+
### Bank Accounts
|
|
248
|
+
|
|
249
|
+
Spritz offers a dedicated interface to manage bank accounts, allowing seamless listing and addition of bank account details for users.
|
|
250
|
+
|
|
251
|
+
#### List user bank accounts
|
|
252
|
+
|
|
253
|
+
To retrieve all bank accounts linked to a user:
|
|
116
254
|
|
|
117
255
|
```typescript
|
|
118
256
|
const bankAccounts = await client.bankAccount.list()
|
|
119
257
|
```
|
|
120
258
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
The bank accounts endpoint returns a standard response comprising an array of all the user-added bank accounts that are available for making payments. This array provides all the necessary information to both display the account details in a user interface and process payments to the respective accounts.
|
|
259
|
+
The `bankAccount.list()` method returns an array of user-linked bank accounts, complete with essential details to display in a UI and facilitate payments:
|
|
124
260
|
|
|
125
261
|
```typescript
|
|
126
262
|
const bankAccounts = [{
|
|
@@ -148,13 +284,14 @@ const bankAccounts = [{
|
|
|
148
284
|
}]
|
|
149
285
|
```
|
|
150
286
|
|
|
151
|
-
|
|
287
|
+
#### Add US bank account
|
|
288
|
+
|
|
289
|
+
Currently, Spritz supports the addition of US bank accounts:
|
|
152
290
|
|
|
153
|
-
|
|
291
|
+
The input structure for adding a US bank account is defined as:
|
|
154
292
|
|
|
155
293
|
```typescript
|
|
156
294
|
// Input arguments for creating a US bank account
|
|
157
|
-
|
|
158
295
|
export interface USBankAccountInput {
|
|
159
296
|
accountNumber: string
|
|
160
297
|
email: string
|
|
@@ -180,78 +317,62 @@ const bankAccounts = await client.bankAccount.create(BankAccountType.USBankAccou
|
|
|
180
317
|
})
|
|
181
318
|
```
|
|
182
319
|
|
|
183
|
-
###
|
|
320
|
+
### Bills
|
|
184
321
|
|
|
185
|
-
|
|
322
|
+
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.
|
|
186
323
|
|
|
187
|
-
|
|
188
|
-
const updateAccount = await client.bankAccount.rename('62d17d3b377dab6c1342136e', 'My new account')
|
|
189
|
-
```
|
|
324
|
+
#### List user bills
|
|
190
325
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
To remove a bank account from a user's account, you can use the following endpoint. You only need to specify the ID of the bank account that you want to delete as an argument.
|
|
194
|
-
|
|
195
|
-
```typescript
|
|
196
|
-
await client.bankAccount.delete('62d17d3b377dab6c1342136e')
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
## Bills
|
|
200
|
-
|
|
201
|
-
Spritz provides robust support for bank accounts, allowing you to easily manage and interact with a user's bank account. To leverage these capabilities, you can utilize our specific methods and functionalities designed for bank accounts.
|
|
202
|
-
|
|
203
|
-
### List user bills
|
|
204
|
-
|
|
205
|
-
You can retrieve a list of all the bills accounts that have been linked to a user's account using this functionality.
|
|
326
|
+
To retrieve all bill accounts associated with a user:
|
|
206
327
|
|
|
207
328
|
```typescript
|
|
208
329
|
const bills = await client.bill.list()
|
|
209
330
|
```
|
|
210
331
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
The bills endpoint returns a response comprising an array of all the bills belonging to the user that are available for making payments. This array provides all the necessary information to both display the account details in a user interface and process payments to the respective accounts.
|
|
332
|
+
The `bill.list()` method returns an array of user-associated bills, complete with essential details for display in a UI and for processing payments:
|
|
214
333
|
|
|
215
334
|
```typescript
|
|
216
|
-
const bills
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
335
|
+
const bills = [
|
|
336
|
+
{
|
|
337
|
+
id: '62d17d3b377dab6c1342136e',
|
|
338
|
+
name: 'Precious Credit Card',
|
|
339
|
+
type: 'Bill',
|
|
340
|
+
billType: 'CreditCard',
|
|
341
|
+
userId: '62d17d3b377dab6c1342136e',
|
|
342
|
+
mask: '4567',
|
|
343
|
+
originator: 'User',
|
|
344
|
+
payable: true,
|
|
345
|
+
verifying: false,
|
|
346
|
+
billAccountDetails: {
|
|
347
|
+
balance: 240.23,
|
|
348
|
+
amountDue: 28.34,
|
|
349
|
+
openedAt: '2023-05-03T11:25:02.401Z',
|
|
350
|
+
lastPaymentAmount: null,
|
|
351
|
+
lastPaymentDate: null,
|
|
352
|
+
nextPaymentDueDate: '2023-06-03T11:25:02.401Z',
|
|
353
|
+
nextPaymentMinimumAmount: 28.34,
|
|
354
|
+
lastStatementBalance: 180.23,
|
|
355
|
+
remainingStatementBalance: null,
|
|
356
|
+
},
|
|
357
|
+
country: 'US',
|
|
358
|
+
currency: 'USD',
|
|
359
|
+
dataSync: {
|
|
360
|
+
lastSync: '2023-05-03T11:25:02.401Z',
|
|
361
|
+
syncStatus: 'Active',
|
|
362
|
+
},
|
|
363
|
+
institution: {
|
|
364
|
+
id: '62d27d4b277dab3c1342126e',
|
|
365
|
+
name: 'Shire Bank Credit Card',
|
|
366
|
+
logo: 'https://tinyurl.com/shire-bank-logo',
|
|
367
|
+
},
|
|
368
|
+
createdAt: '2023-05-03T11:25:02.401Z',
|
|
369
|
+
},
|
|
370
|
+
]
|
|
250
371
|
```
|
|
251
372
|
|
|
252
|
-
|
|
373
|
+
#### Add US bill account
|
|
253
374
|
|
|
254
|
-
|
|
375
|
+
Currently, Spritz allows the addition of US bill accounts only. The process involves identifying the institution managing the bill and inputting the bill's account number. Here's a guide on how to add a bill for a user:
|
|
255
376
|
|
|
256
377
|
```typescript
|
|
257
378
|
import { BillType } from '@spritz-finance/api-client'
|
|
@@ -263,47 +384,96 @@ const accountNumber = '12345678913213'
|
|
|
263
384
|
const bill = await client.bill.create(billInstitution.id, accountNumber, BillType.CreditCard)
|
|
264
385
|
```
|
|
265
386
|
|
|
266
|
-
###
|
|
387
|
+
### Virtual Card
|
|
267
388
|
|
|
268
|
-
|
|
389
|
+
Spritz offers the ability to create virtual cards that users can fund using cryptocurrency. These virtual cards represent an alternative payment account offered by Spritz. To effectively interact with the Virtual Card feature, use the API endpoints detailed below.
|
|
390
|
+
|
|
391
|
+
#### Fetch a users virtual card
|
|
392
|
+
|
|
393
|
+
The fetch endpoint returns an object containing details associated with the virtual card. Importantly, this object excludes sensitive card information such as the card number and the CVV.
|
|
269
394
|
|
|
270
395
|
```typescript
|
|
271
|
-
const
|
|
396
|
+
const virtualCard = await client.virtualCard.fetch()
|
|
272
397
|
```
|
|
273
398
|
|
|
274
|
-
|
|
399
|
+
```typescript
|
|
400
|
+
const virtualCard = {
|
|
401
|
+
id: '62d17d3b377dab6c1342136e',
|
|
402
|
+
type: 'VirtualCard',
|
|
403
|
+
virtualCardType: 'USVirtualDebitCard',
|
|
404
|
+
userId: '62d17d3b377dab6c1342136e',
|
|
405
|
+
mask: '0001',
|
|
406
|
+
country: 'US',
|
|
407
|
+
currency: 'USD',
|
|
408
|
+
balance: 0,
|
|
409
|
+
renderSecret: 'U2FsdGVkX18bLYGYLILf4AeW5fOl8VYxAvKWVDtbZI5DO7swFqkJ2o',
|
|
410
|
+
billingInfo: {
|
|
411
|
+
holder: 'Bilbo Baggins',
|
|
412
|
+
phone: '+123456789',
|
|
413
|
+
email: 'bilbo@shiremail.net',
|
|
414
|
+
address: {
|
|
415
|
+
street: '1 Bagshot Row',
|
|
416
|
+
street2: '',
|
|
417
|
+
city: 'Hobbiton',
|
|
418
|
+
subdivision: 'The Shire',
|
|
419
|
+
postalCode: '12345',
|
|
420
|
+
countryCode: 'ME',
|
|
421
|
+
},
|
|
422
|
+
},
|
|
423
|
+
}
|
|
424
|
+
```
|
|
275
425
|
|
|
276
|
-
|
|
426
|
+
#### Create a US virtual debit card
|
|
277
427
|
|
|
278
428
|
```typescript
|
|
279
|
-
|
|
429
|
+
import { VirtualCardType } from '@spritz-finance/api-client'
|
|
430
|
+
|
|
431
|
+
const virtualCard = await client.virtualCard.create(VirtualCardType.USVirtualDebitCard)
|
|
280
432
|
```
|
|
281
433
|
|
|
282
|
-
|
|
434
|
+
#### Displaying sensitive card details
|
|
283
435
|
|
|
284
|
-
|
|
436
|
+
To show the sensitive card details that users require for payment transactions, you must integrate our dedicated drop-in widget. This widget securely renders card details. Use the renderSecret, obtained from the standard fetch card endpoint, in conjunction with the user's API key.
|
|
285
437
|
|
|
286
|
-
|
|
438
|
+
We currently support and maintain the following packages for the card rendering process:
|
|
287
439
|
|
|
288
|
-
|
|
440
|
+
- [React Library](https://www.npmjs.com/package/@spritz-finance/react-secure-elements)
|
|
441
|
+
- [React Native Library](https://www.npmjs.com/package/@spritz-finance/react-native-secure-elements)
|
|
442
|
+
|
|
443
|
+
## Renaming accounts
|
|
444
|
+
|
|
445
|
+
### Rename a bank account
|
|
446
|
+
|
|
447
|
+
You can conveniently change the display name of a bank account using the following endpoint. The first argument specifies the ID of the bank account, while the second argument represents the desired new name for the account.
|
|
289
448
|
|
|
290
449
|
```typescript
|
|
291
|
-
const
|
|
450
|
+
const updateAccount = await client.bankAccount.rename('62d17d3b377dab6c1342136e', 'My new account')
|
|
451
|
+
```
|
|
292
452
|
|
|
293
|
-
|
|
294
|
-
|
|
453
|
+
### Rename a bill
|
|
454
|
+
|
|
455
|
+
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.
|
|
456
|
+
|
|
457
|
+
```typescript
|
|
458
|
+
const updateAccount = await client.bill.rename('62d17d3b377dab6c1342136e', 'My first credit card')
|
|
295
459
|
```
|
|
296
460
|
|
|
297
|
-
|
|
461
|
+
## Deleting accounts
|
|
462
|
+
|
|
463
|
+
### Delete a bank account
|
|
464
|
+
|
|
465
|
+
To remove a bank account from a user's account, you can use the following endpoint. You only need to specify the ID of the bank account that you want to delete as an argument.
|
|
298
466
|
|
|
299
467
|
```typescript
|
|
300
|
-
|
|
468
|
+
await client.bankAccount.delete('62d17d3b377dab6c1342136e')
|
|
469
|
+
```
|
|
301
470
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
471
|
+
### Delete a bill
|
|
472
|
+
|
|
473
|
+
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.
|
|
474
|
+
|
|
475
|
+
```typescript
|
|
476
|
+
await client.bill.delete('62d17d3b377dab6c1342136e')
|
|
307
477
|
```
|
|
308
478
|
|
|
309
479
|
## Bill Institutions
|
|
@@ -333,64 +503,6 @@ const institutions = await client.institution.searchUSBillInstitutions(
|
|
|
333
503
|
)
|
|
334
504
|
```
|
|
335
505
|
|
|
336
|
-
## Virtual Cards
|
|
337
|
-
|
|
338
|
-
Spritz enables the creation of virtual cards, which can be funded using cryptocurrency. Similar to bank accounts, these virtual cards represent an additional type of payable account provided by Spritz. Utilize the endpoints detailed below to interact with the Virtual Card API.
|
|
339
|
-
|
|
340
|
-
### Fetch a users virtual card
|
|
341
|
-
|
|
342
|
-
The fetch endpoint returns an object encompassing all the details associated with the virtual card. Please note, this object does not include sensitive card information such as the card number or the CVV.
|
|
343
|
-
|
|
344
|
-
```typescript
|
|
345
|
-
const virtualCard = await client.virtualCard.fetch()
|
|
346
|
-
```
|
|
347
|
-
|
|
348
|
-
#### Example response
|
|
349
|
-
|
|
350
|
-
```typescript
|
|
351
|
-
const virtualCard = {
|
|
352
|
-
id: '62d17d3b377dab6c1342136e',
|
|
353
|
-
type: 'VirtualCard',
|
|
354
|
-
virtualCardType: 'USVirtualDebitCard',
|
|
355
|
-
userId: '62d17d3b377dab6c1342136e',
|
|
356
|
-
mask: '0001',
|
|
357
|
-
country: 'US',
|
|
358
|
-
currency: 'USD',
|
|
359
|
-
balance: 0,
|
|
360
|
-
renderSecret: 'U2FsdGVkX18bLYGYLILf4AeW5fOl8VYxAvKWVDtbZI5DO7swFqkJ2o',
|
|
361
|
-
billingInfo: {
|
|
362
|
-
holder: 'Bilbo Baggins',
|
|
363
|
-
phone: '+123456789',
|
|
364
|
-
email: 'bilbo@shiremail.net',
|
|
365
|
-
address: {
|
|
366
|
-
street: '1 Bagshot Row',
|
|
367
|
-
street2: '',
|
|
368
|
-
city: 'Hobbiton',
|
|
369
|
-
subdivision: 'The Shire',
|
|
370
|
-
postalCose: '12345',
|
|
371
|
-
countryCode: 'ME',
|
|
372
|
-
},
|
|
373
|
-
},
|
|
374
|
-
}
|
|
375
|
-
```
|
|
376
|
-
|
|
377
|
-
### Create a US virtual debit card
|
|
378
|
-
|
|
379
|
-
```typescript
|
|
380
|
-
import { VirtualCardType } from '@spritz-finance/api-client'
|
|
381
|
-
|
|
382
|
-
const virtualCard = await client.virtualCard.create(VirtualCardType.USVirtualDebitCard)
|
|
383
|
-
```
|
|
384
|
-
|
|
385
|
-
### Displaying sensitive card details
|
|
386
|
-
|
|
387
|
-
In order to display the sensitive card details necessary for a user to make payments, you must utilize our drop-in widget, which securely renders the card. This process requires the renderSecret, returned from the standard fetch card endpoint, in combination with the user's API key.
|
|
388
|
-
|
|
389
|
-
We currently offer and maintain the following packages to assist with the card rendering process:
|
|
390
|
-
|
|
391
|
-
- [React Library](https://www.npmjs.com/package/@spritz-finance/react-secure-elements)
|
|
392
|
-
- [React Native Library](https://www.npmjs.com/package/@spritz-finance/react-native-secure-elements)
|
|
393
|
-
|
|
394
506
|
## Payment Requests
|
|
395
507
|
|
|
396
508
|
A payment request refers to the intent to initiate a payment to a specific account. Once a payment request is created, a blockchain transaction is required to fulfill it. After the blockchain transaction settles, the payment request is completed, and a fiat payment is issued to the designated account.
|