POST /dapi/v1/connect/sessions and open its url in the popup.
The holder signs in with Google or a one-time email code. The window shows no separate consent screen and no HEVN product screens.
Configure the window
In the HEVN app, open Settings → Partner program → Developer. In the Sign-in window card, Allowed sites lists the origins the window may return to.- An origin is
https://host, orhttp://localhost:<port>andhttp://127.0.0.1:<port>in development, with no path or query. - The list holds up to 20 origins. An empty list allows no session.
- Removing an origin stops the sessions already issued for it.
- HEVN sets the title, logo, colours and theme on request. The API and the session URL cannot change them.
POST /dapi/v1/connect/sessions and POST /dapi/v1/clients/link return 403 client_creation_not_enabled.
Link an account
1. Open the popup
Open an empty window in the click handler, before anyawait, then navigate it to the session url. Browsers block a popup opened later.
Browser
2. Create a session
CallPOST /dapi/v1/connect/sessions from your server with your access token, without X-Hevn-Account. The action values and field rules are in Create a sign-in window session.
Response 201
url and binds it to your integrator account, the action, the payout or client, and redirectUri. It also binds a one-time nonce, returned as state.
3. Bind the session to this browser
Storestate in an HttpOnly cookie when you create the session. Accept a code only when the browser returns the same state with that cookie.
Node
4. Exchange the code
Exchange the returnedcode from your server with POST /dapi/v1/clients/link. Its validity and retry rules are in Connect an existing account.
Response 200
id on your server and send it in X-Hevn-Account. Do not accept it from the browser.
On 400 link_code_invalid or 410 link_code_expired, start a new sign-in. Do not retry 409 client_already_linked.
Pass a known email
To sign the holder in with an email you hold, addlogin_hint to the session URL. Do it before you navigate the popup.
Browser
login_hint is not signed and does not prove who signed in. POST /dapi/v1/clients/link returns the account that did.
The callback page
The window finishes by navigating toredirectUri with state and the result in the query string.
The callback page posts the query to the opener over a
BroadcastChannel, because window.opener is null after Google sign-in.
callback.html
state matches its session.
Browser
BroadcastChannel reaches pages of one origin, so serve the callback page from the opener’s origin. Matching state in the browser routes the result and does not authenticate it. The cookie check in step 3 does.
hevn-inc/dapi-sdk has this browser code as
HevnConnect. The repository is a reference and is not a supported package.Who can be linked
An account can be linked only if it was created in the sign-in window. The window signs out any HEVN session in the browser before eachlink sign-in, so the holder chooses the account.
The window names your product. It tells the holder that you can see balances, request virtual accounts and prepare transfers. It also says that the holder approves each transfer in the window.
Approve a payout
A payout booked for a linked client returnsauthorization: "client", and the holder signs it. Create a sign session with the call from step 2 and open the popup as for a link.
POST /dapi/v1/connect/sessions
404 payout_not_found when the payout does not belong to a client linked to you. It returns 409 payout_not_awaiting_signature when the payout is no longer awaitingSignature.
The holder signs in, or reuses a HEVN session open in that browser. The window shows the amount, the contact’s name and who requested the payout. The holder’s wallet signs the debit.
The callback receives status=submitted, payout=po_… and, when the debit was sent, reference. If the payout was no longer waiting when the window opened, nothing is signed. The callback receives its current status.
Do not act on the redirect. Read GET /dapi/v1/payouts/{payoutId} with the client in X-Hevn-Account and follow it to settled (Money movement).
Verify an individual
A linked individual verifies their identity in averify session. HEVN does not issue a verification link to you. A business client verifies through KYB.
Create a verify session when a virtual account has the verification_required blocker, and open the popup as for a link.
404 client_not_found for a client that does not exist or is not linked to you. It returns 409 verification_not_applicable for a business client. For a verified client, the window says so and returns status=approved.
The identity check runs in the window. When the holder finishes or closes it, the callback receives status.
A review can finish after the window closes. Poll
verifiedAt on GET /dapi/v1/client, or poll GET /dapi/v1/banks/{product}.
In the sandbox the window accepts test documents. In automated tests, verify an individual with POST /dapi/v1/sandbox/kyb/status.
Errors
The window returns a refusal aserror on the redirect. API errors are in the error reference.
A session that is invalid or expired when it opens sends no result. The window shows “This link has expired or is invalid”. Stop waiting at expiresAt and close the popup.