@spritz-finance/api-client 0.13.0 → 0.15.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 +23 -3
- package/dist/spritz-api-client.cjs +61 -61
- package/dist/spritz-api-client.d.ts +179 -46
- package/dist/spritz-api-client.mjs +61 -61
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -168,13 +168,15 @@ const userData = await client.user.getCurrentUser()
|
|
|
168
168
|
```typescript
|
|
169
169
|
const me = await client.user.getMe()
|
|
170
170
|
|
|
171
|
-
me.verification.status // 'not_started' | 'verified' | 'failed' | 'disabled' | 'retry'
|
|
171
|
+
me.verification.status // 'not_started' | 'verified' | 'failed' | 'disabled' | 'retry' | 'under_review'
|
|
172
|
+
me.verification.failureReason // e.g. 'documentary_verification', or null unless failed / retry / under_review
|
|
173
|
+
me.verification.provider // 'persona' | 'plaid' — the provider the next verification session will use
|
|
172
174
|
me.verification.country // e.g. 'US', or null
|
|
173
175
|
me.verification.requirement // outstanding requirement, if any ({ type, status, actionUrl?, retryable? })
|
|
174
176
|
me.capabilities // [{ product, method?, name, status, nextRequirement?, requirements }]
|
|
175
177
|
```
|
|
176
178
|
|
|
177
|
-
|
|
179
|
+
`status: 'retry'` (with an `identity_verification` requirement whose `retryable` is `true`) means a failed verification can be retried by calling `verification.createSession()` again; `under_review` means a decision is pending and no new session can be started. This is the REST replacement for `getCurrentUser()` verification state and `retryFailedVerification()`.
|
|
178
180
|
|
|
179
181
|
### Identity Verification
|
|
180
182
|
|
|
@@ -207,7 +209,9 @@ const { sessionId, provider, sessionToken, verificationUrl, verificationUrlExpir
|
|
|
207
209
|
// verificationUrl: provider-hosted URL, or null
|
|
208
210
|
```
|
|
209
211
|
|
|
210
|
-
|
|
212
|
+
The same call retries a failed verification: when `getMe().verification.status` is `retry`, it starts a new inquiry and returns the new session. There is no separate retry endpoint.
|
|
213
|
+
|
|
214
|
+
Tokens and URLs may expire, so create the session just in time rather than caching it. The call throws a `ConflictError` (409) with one of `VERIFICATION_NOT_RETRYABLE` (permanent failure), `VERIFICATION_UNDER_REVIEW`, `VERIFICATION_ALREADY_VERIFIED`, or `VERIFICATION_SESSION_UNAVAILABLE`, a 409 with no code while another session request for the same user is still in progress (retry after it completes), and an `InternalServerError` (503, with `retryAfter` seconds in the error body) when the provider is temporarily unavailable.
|
|
211
215
|
|
|
212
216
|
#### Option 1: Verification URL
|
|
213
217
|
|
|
@@ -1011,6 +1015,22 @@ ACH onramp lets users convert USD from their bank account into USDC delivered to
|
|
|
1011
1015
|
5. **Server:** prepare a quote with `client.deposit.prepare(...)`
|
|
1012
1016
|
6. **Client:** show the quote and ACH authorization message to the user
|
|
1013
1017
|
7. **Server:** create the deposit with `client.deposit.create(input, { idempotencyKey })`; Spritz runs risk checks before initiating the ACH pull. Persist one unique key per deposit intent and reuse it verbatim on retries so a timed-out request replays the original response instead of authorizing a second debit
|
|
1018
|
+
8. **Server:** track the deposit with `client.deposit.get(depositId)`, or reconcile a backlog by paging `client.deposit.list({ limit, cursor })`
|
|
1019
|
+
|
|
1020
|
+
```typescript
|
|
1021
|
+
// Page the authenticated user's deposits, newest first
|
|
1022
|
+
const { data, hasMore, nextCursor } = await client.deposit.list({ limit: 25 })
|
|
1023
|
+
|
|
1024
|
+
if (hasMore && nextCursor) {
|
|
1025
|
+
const next = await client.deposit.list({ limit: 25, cursor: nextCursor })
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
// Read one deposit's ACH debit and crypto release state
|
|
1029
|
+
const deposit = await client.deposit.get('dep_01JV7Q8M4Y8K6N2Z5P3R1T9W0X')
|
|
1030
|
+
console.log(deposit.status, deposit.debitStatus, deposit.releaseStatus)
|
|
1031
|
+
```
|
|
1032
|
+
|
|
1033
|
+
`client.deposit.list()` is user-scoped, so an integrator-wide reconciliation iterates your own user roster and authorizes each user's read with `client.setApiKey(userApiKey)`. Webhooks are notifications, not the only record of deposits.
|
|
1014
1034
|
|
|
1015
1035
|
Authorization is derived from the verified ACH funding source — no wallet signature is required.
|
|
1016
1036
|
|