@spritz-finance/api-client 0.4.12 → 0.4.14
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 +78 -3
- package/dist/spritz-api-client.cjs +78 -68
- package/dist/spritz-api-client.d.ts +38 -1
- package/dist/spritz-api-client.mjs +78 -68
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -229,7 +229,11 @@ All users must undergo basic identity verification before they can engage with t
|
|
|
229
229
|
|
|
230
230
|
### How to Present Verification Flow to the User
|
|
231
231
|
|
|
232
|
-
|
|
232
|
+
Spritz offers two methods for integrating KYC verification:
|
|
233
|
+
|
|
234
|
+
#### Method 1: Verification URL (Simple Integration)
|
|
235
|
+
|
|
236
|
+
Use the `verificationUrl` for a straightforward integration where Spritz handles the entire verification flow:
|
|
233
237
|
|
|
234
238
|
- **Browser**: Open the URL in a new browser tab.
|
|
235
239
|
- **In-App**: Embed the URL in an iframe within your application.
|
|
@@ -245,6 +249,29 @@ const verifiedCountry = userData.verifiedCountry
|
|
|
245
249
|
const canRetryVerification = userData.canRetryVerification
|
|
246
250
|
```
|
|
247
251
|
|
|
252
|
+
#### Method 2: Verification Token (Advanced Integration)
|
|
253
|
+
|
|
254
|
+
For more control over the verification experience, use the verification token approach with the Plaid Link SDK:
|
|
255
|
+
|
|
256
|
+
```typescript
|
|
257
|
+
// Get a verification token from Spritz
|
|
258
|
+
const verificationToken = await client.user.getVerificationToken()
|
|
259
|
+
|
|
260
|
+
// Use the token with Plaid Link SDK to create a custom verification flow
|
|
261
|
+
// This allows you to:
|
|
262
|
+
// - Customize the UI/UX of the verification process
|
|
263
|
+
// - Handle callbacks and events directly
|
|
264
|
+
// - Integrate verification seamlessly into your application flow
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
The verification token method is ideal when you want to:
|
|
268
|
+
- Maintain full control over the user experience
|
|
269
|
+
- Integrate verification directly into your app without redirects
|
|
270
|
+
- Handle verification events and callbacks programmatically
|
|
271
|
+
- Build a native mobile experience using Plaid's mobile SDKs
|
|
272
|
+
|
|
273
|
+
See the [Plaid Link documentation](https://plaid.com/docs/link/) for detailed integration instructions with the verification token.
|
|
274
|
+
|
|
248
275
|
## Payment Flow
|
|
249
276
|
|
|
250
277
|
### Basic payment flow
|
|
@@ -844,6 +871,45 @@ const fees = await client.paymentRequest.transactionPrice(101)
|
|
|
844
871
|
|
|
845
872
|
Payments represent a fiat payment that has been issued to the account. Once the status of the Payment Request has moved to `Confirmed` then the Payment will be created.
|
|
846
873
|
|
|
874
|
+
### Transaction Details
|
|
875
|
+
|
|
876
|
+
Payments now include transaction details about the blockchain transaction that fulfilled the payment. When a payment is completed, the `transaction` field contains:
|
|
877
|
+
|
|
878
|
+
- **hash**: The blockchain transaction hash
|
|
879
|
+
- **from**: The wallet address that sent the payment
|
|
880
|
+
- **asset**: The token contract address used for payment
|
|
881
|
+
- **value**: The amount transferred (in the token's smallest unit)
|
|
882
|
+
- **network**: The blockchain network used (e.g., 'ethereum', 'polygon', etc.)
|
|
883
|
+
|
|
884
|
+
This allows you to track the on-chain transaction that corresponds to each fiat payment.
|
|
885
|
+
|
|
886
|
+
### Retrieve a payment by ID
|
|
887
|
+
|
|
888
|
+
You can fetch a payment directly by its ID:
|
|
889
|
+
|
|
890
|
+
```typescript
|
|
891
|
+
const payment = await client.payment.fetchById('6368e3a3ec516e9572bbd23b');
|
|
892
|
+
|
|
893
|
+
// Example response
|
|
894
|
+
|
|
895
|
+
{
|
|
896
|
+
id: '6368e3a3ec516e9572bbd23b',
|
|
897
|
+
userId: '63d12d3B577fab6c6382136e',
|
|
898
|
+
status: 'COMPLETED',
|
|
899
|
+
accountId: '6322445f10d3f4d19c4d72fe',
|
|
900
|
+
amount: 100,
|
|
901
|
+
feeAmount: null,
|
|
902
|
+
createdAt: '2022-11-07T10:53:23.998Z',
|
|
903
|
+
transaction: {
|
|
904
|
+
hash: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
|
|
905
|
+
from: '0xYourWalletAddress',
|
|
906
|
+
asset: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
|
|
907
|
+
value: 100000000,
|
|
908
|
+
network: 'ethereum'
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
```
|
|
912
|
+
|
|
847
913
|
### Retrieve the payment for a payment request
|
|
848
914
|
|
|
849
915
|
```typescript
|
|
@@ -866,7 +932,8 @@ const payment = await client.payment.getForPaymentRequest(paymentRequest.id);
|
|
|
866
932
|
accountId: '6322445f10d3f4d19c4d72fe',
|
|
867
933
|
amount: 100,
|
|
868
934
|
feeAmount: null,
|
|
869
|
-
createdAt: '2022-11-07T10:53:23.998Z'
|
|
935
|
+
createdAt: '2022-11-07T10:53:23.998Z',
|
|
936
|
+
transaction: null // Will be populated once the payment is fulfilled
|
|
870
937
|
}
|
|
871
938
|
|
|
872
939
|
```
|
|
@@ -882,11 +949,19 @@ const payments = await client.payment.listForAccount(account.id)
|
|
|
882
949
|
{
|
|
883
950
|
id: '6368e3a3ec516e9572bbd23b',
|
|
884
951
|
userId: '63d12d3B577fab6c6382136e',
|
|
885
|
-
status: '
|
|
952
|
+
status: 'COMPLETED',
|
|
886
953
|
accountId: '6322445f10d3f4d19c4d72fe',
|
|
887
954
|
amount: 100,
|
|
888
955
|
feeAmount: null,
|
|
889
956
|
createdAt: '2022-11-07T10:53:23.998Z',
|
|
957
|
+
transaction: {
|
|
958
|
+
__typename: 'BlockchainTransaction',
|
|
959
|
+
hash: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
|
|
960
|
+
from: '0xYourWalletAddress',
|
|
961
|
+
asset: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
|
|
962
|
+
value: 100000000,
|
|
963
|
+
network: 'ethereum'
|
|
964
|
+
}
|
|
890
965
|
},
|
|
891
966
|
]
|
|
892
967
|
```
|