@spritz-finance/api-client 0.4.15 → 0.4.17
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 +54 -0
- package/dist/spritz-api-client.cjs +54 -48
- package/dist/spritz-api-client.d.ts +68 -2
- package/dist/spritz-api-client.mjs +55 -49
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -247,6 +247,9 @@ const verificationStatus = userData.verificationStatus
|
|
|
247
247
|
const verificationUrl = userData.verificationUrl
|
|
248
248
|
const verifiedCountry = userData.verifiedCountry
|
|
249
249
|
const canRetryVerification = userData.canRetryVerification
|
|
250
|
+
|
|
251
|
+
// Access verification metadata for failed verifications
|
|
252
|
+
const verificationMetadata = userData.verificationMetadata
|
|
250
253
|
```
|
|
251
254
|
|
|
252
255
|
#### Method 2: Verification Token (Advanced Integration)
|
|
@@ -272,6 +275,57 @@ The verification token method is ideal when you want to:
|
|
|
272
275
|
|
|
273
276
|
See the [Plaid Link documentation](https://plaid.com/docs/link/) for detailed integration instructions with the verification token.
|
|
274
277
|
|
|
278
|
+
### Verification Metadata (Failed Verifications)
|
|
279
|
+
|
|
280
|
+
When a user's verification fails, Spritz now provides additional metadata to help understand the failure reason and provide better user experience. This metadata is particularly useful for handling duplicate identity scenarios.
|
|
281
|
+
|
|
282
|
+
#### Understanding Verification Metadata
|
|
283
|
+
|
|
284
|
+
The verification metadata is available when a verification has failed and includes:
|
|
285
|
+
|
|
286
|
+
- **`failureReason`**: The specific reason why the verification failed
|
|
287
|
+
- **`details.matchedEmail`**: For duplicate identity failures, shows the email of the matched user (only if created through the same integration)
|
|
288
|
+
|
|
289
|
+
#### Verification Failure Reasons
|
|
290
|
+
|
|
291
|
+
The following verification failure reasons may be returned:
|
|
292
|
+
|
|
293
|
+
- **`verify_sms`**: SMS verification failed
|
|
294
|
+
- **`documentary_verification`**: Document verification failed
|
|
295
|
+
- **`risk_check`**: Risk assessment check failed
|
|
296
|
+
- **`kyc_check`**: KYC (Know Your Customer) check failed
|
|
297
|
+
- **`watchlist_screening`**: Watchlist screening check failed
|
|
298
|
+
- **`selfie_check`**: Selfie verification check failed
|
|
299
|
+
- **`address_invalid`**: Provided address is invalid
|
|
300
|
+
- **`duplicate_identity`**: Identity already exists in the system
|
|
301
|
+
|
|
302
|
+
#### Duplicate Identity Handling
|
|
303
|
+
|
|
304
|
+
When a verification fails due to `duplicate_identity`, the system detects that the user has already been verified under a different account. The `matchedEmail` field helps determine:
|
|
305
|
+
|
|
306
|
+
- **If `matchedEmail` is populated**: The duplicate user was created through your integration
|
|
307
|
+
- **If `matchedEmail` is `null`**: The duplicate user was created through a different integration (e.g., the main Spritz app)
|
|
308
|
+
|
|
309
|
+
This allows you to provide appropriate guidance to your users:
|
|
310
|
+
|
|
311
|
+
```typescript
|
|
312
|
+
const userData = await client.user.getCurrentUser()
|
|
313
|
+
|
|
314
|
+
if (userData.verificationMetadata?.failureReason === 'duplicate_identity') {
|
|
315
|
+
const matchedEmail = userData.verificationMetadata.details.matchedEmail
|
|
316
|
+
|
|
317
|
+
if (matchedEmail) {
|
|
318
|
+
// User exists within your integration
|
|
319
|
+
console.log(`This identity is already verified with account: ${matchedEmail}`)
|
|
320
|
+
// Guide user to use their existing account
|
|
321
|
+
} else {
|
|
322
|
+
// User exists in Spritz but not in your integration
|
|
323
|
+
console.log('This identity is already verified with another Spritz account')
|
|
324
|
+
// Inform user they need to use their original Spritz account
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
```
|
|
328
|
+
|
|
275
329
|
## Payment Flow
|
|
276
330
|
|
|
277
331
|
### Basic payment flow
|