@spritz-finance/api-client 0.17.0 → 0.18.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
@@ -90,6 +90,7 @@ const transactionData = await client.paymentRequest.getWeb3PaymentParams({
90
90
  - [Virtual Accounts](#virtual-accounts)
91
91
  - [Supported Tokens](#supported-tokens)
92
92
  - [ACH Onramp (Direct Debit)](#ach-onramp-direct-debit)
93
+ - [Checking Eligibility](#checking-eligibility)
93
94
  - [Sandbox](#sandbox)
94
95
  - [Bypassing KYC](#bypassing-kyc)
95
96
  - [Webhooks](#webhooks)
@@ -1008,6 +1009,7 @@ const accounts = await client.virtualAccounts.list()
1008
1009
 
1009
1010
  ACH onramp lets users convert USD from their bank account into USDC delivered to a Solana wallet. The integration is a short server-side flow with one client-side Plaid step:
1010
1011
 
1012
+ 0. **Server:** check that the bank deposit option can be offered at all with `client.achDebit.checkEligibility({ email })` (see [Checking Eligibility](#checking-eligibility))
1011
1013
  1. **Server:** create a Plaid link token with `client.bankAccount.createLinkToken()`
1012
1014
  2. **Client:** run Plaid Link and send the public token/account IDs back to your server
1013
1015
  3. **Server:** complete linking with `client.bankAccount.completeLinking(...)`
@@ -1051,6 +1053,24 @@ For a complete walkthrough with code examples, request/response schemas, and dep
1051
1053
 
1052
1054
  A standalone sandbox demo is available at `scripts/sandbox/ach-onramp.html`. Run `yarn build && node scripts/sandbox/evidence-server.mjs`, then open `http://localhost:3001/ach-onramp.html` to test the SDK-backed flow and save redacted QC evidence.
1053
1055
 
1056
+ ### Checking Eligibility
1057
+
1058
+ Before you show a bank deposit option to someone who is not yet a Spritz user, ask whether it is available for their email address:
1059
+
1060
+ ```typescript
1061
+ const { eligible } = await client.achDebit.checkEligibility({ email: 'user@example.com' })
1062
+
1063
+ if (eligible) {
1064
+ // Offer the bank deposit option
1065
+ }
1066
+ ```
1067
+
1068
+ This route authenticates as the integrator over HMAC and takes no user bearer key, because the address it asks about need not belong to an existing user yet.
1069
+
1070
+ Eligibility only moves in one direction — once an address is eligible it stays eligible — so `eligible: false` may be transient. Re-check it rather than caching the negative against the address.
1071
+
1072
+ Once the user exists, stop asking: the capabilities on `client.user.getUserAccess()` become the source of truth for whether the option is available to them.
1073
+
1054
1074
  ## Error Handling
1055
1075
 
1056
1076
  Every non-2xx REST response throws an `APIError` subclass chosen by status (`BadRequestError`, `AuthenticationError`, `PermissionDeniedError`, `NotFoundError`, `ConflictError`, `UnprocessableEntityError`, `RateLimitError`, `InternalServerError`). Transport failures throw `APIConnectionError`, and a timeout throws `APIConnectionTimeoutError`.