@spritz-finance/api-client 0.0.11 → 0.1.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/README.md CHANGED
@@ -21,27 +21,26 @@ A Typescript library for interacting with the Spritz Finance API
21
21
  ## Usage
22
22
 
23
23
  Your integration key is provided by Spritz and must always be provided.
24
- The api key is specific to each user,
25
- and is returned once the user is created. Leave the api key blank if you haven't created the user yet.
24
+ The api key is specific to each user,
25
+ and is returned once the user is created. Leave the api key blank if you haven't created the user yet.
26
26
 
27
27
  ```typescript
28
28
  import { SpritzApiClient, Environment } from '@spritz-finance/api-client'
29
29
 
30
30
  const client = SpritzApiClient.initialize({
31
31
  environment: Environment.Staging,
32
- apiKey: 'YOUR_USER_API_KEY_HERE',
32
+ apiKey: 'YOUR_USER_API_KEY_HERE',
33
33
  integrationKey: 'YOUR_INTEGRATION_KEY_HERE',
34
34
  })
35
35
  ```
36
36
 
37
37
  ## User Creation
38
38
 
39
- You start the process by transmitting the user's email address.
39
+ A new Spritz user can be created by supplying the user's email address.
40
40
 
41
41
  ```typescript
42
- // Fetch all bank accounts for the user
43
- const user = await client.user.createUser({
44
- email: "bilbo@shiremail.net"
42
+ const user = await client.user.create({
43
+ email: 'bilbo@shiremail.net',
45
44
  })
46
45
 
47
46
  // user = {
@@ -49,8 +48,6 @@ const user = await client.user.createUser({
49
48
  // userId: "62d17d3b377dab6c1342136e",
50
49
  // apiKey: "ak_ZTBGDcjfdTg3NmYtZDJlZC00ZjYyLThlMDMtZmYwNDJiZDRlMWZm"
51
50
  // }
52
-
53
-
54
51
  ```
55
52
 
56
53
  Once the user is created, set the api client to use the user's api key:
@@ -199,6 +196,63 @@ To remove a bank account from a user's account, you can use the following endpoi
199
196
  await client.bankAccounts.delete('62d17d3b377dab6c1342136e')
200
197
  ```
201
198
 
199
+ ## Virtual Cards
200
+
201
+ 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.
202
+
203
+ ### Fetch a users virtual card
204
+
205
+ 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.
206
+
207
+ ```typescript
208
+ const virtualCard = await client.virtualCard.fetch()
209
+ ```
210
+
211
+ #### Example response
212
+
213
+ ```typescript
214
+ const virtualCard = {
215
+ id: '62d17d3b377dab6c1342136e',
216
+ type: 'VirtualCard',
217
+ virtualCardType: 'USVirtualDebitCard',
218
+ userId: '62d17d3b377dab6c1342136e',
219
+ mask: '0001',
220
+ country: 'US',
221
+ currency: 'USD',
222
+ balance: 0,
223
+ renderSecret: 'U2FsdGVkX18bLYGYLILf4AeW5fOl8VYxAvKWVDtbZI5DO7swFqkJ2o',
224
+ billingInfo: {
225
+ holder: 'Bilbo Baggins',
226
+ phone: '+123456789',
227
+ email: 'bilbo@shiremail.net',
228
+ address: {
229
+ street: '1 Bagshot Row',
230
+ street2: '',
231
+ city: 'Hobbiton',
232
+ subdivision: 'The Shire',
233
+ postalCose: '12345',
234
+ countryCode: 'ME',
235
+ },
236
+ },
237
+ }
238
+ ```
239
+
240
+ ### Create a US virtual debit card
241
+
242
+ ```typescript
243
+ import { VirtualCardType } from '@spritz-finance/api-client'
244
+
245
+ const virtualCard = await client.virtualCard.create(VirtualCardType.USVirtualDebitCard)
246
+ ```
247
+
248
+ ### Displaying sensitive card details
249
+
250
+ 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.
251
+
252
+ We currently offer and maintain the following packages to assist with the card rendering process:
253
+
254
+ - [React Native Library](https://www.npmjs.com/package/@spritz-finance/react-native-secure-elements)
255
+
202
256
  ## Payment Requests
203
257
 
204
258
  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.