POST /dapi/v1/auth/challenge and POST /dapi/v1/auth/token.
Before you start
- Sign up at
https://sandbox.gethevn.com. - Open Settings → Partner program → Developer and create a developer key. Set its IP allowlist to your machine’s egress address.
- Save the private key to
$HEVN_KEY_PEMwith mode0600. - In the Sign-in window card, add
http://localhost:8080under Allowed sites and save. - Have a second Google account with no HEVN sandbox account. Linking an existing account fails with
already_registered. - Set the environment and install the dependencies.
Developer keys, clients and tokens are per environment.
The examples read these variables:
The sandbox runs on Base Sepolia with testnet tokens. A payout, escrow or payin is capped at
1, and a faucet credit at 5 to a wallet holding less than 1. The sandbox money routes take 60 calls per account per hour. See Sandbox limits.Steps
1
Log in
Run the login code in Sessions. Export
accessToken as HEVN_ACCESS_TOKEN and userId as HEVN_USER_ID. The Python, Node and Go tabs use the reference client.2
Serve the two pages
Save both files in an empty folder and serve it on the allowed origin.Open
index.html
callback.html
http://localhost:8080. A production page needs the checks in Sign in with HEVN.3
Create a link session
Call
POST /dapi/v1/connect/sessions with action: "link". Do not send X-Hevn-Account.Response
4
Sign in as the customer
Paste the URL into the page within 10 minutes, click Open HEVN and sign in with the second Google account. The page shows the result.
5
Exchange the code
Call Export the id as
POST /dapi/v1/clients/link with the code within 5 minutes.Response
HEVN_CLIENT_ID. While status is provisioning, poll GET /dapi/v1/client with the id in X-Hevn-Account every two seconds.6
Fund the wallet
Call
POST /dapi/v1/sandbox/deposits with the client id in X-Hevn-Account.200 means the tokens are in the wallet. On 202, repeat the request with the same Idempotency-Key.7
Read the balance
Call
GET /dapi/v1/client/balance. Without X-Hevn-Account the route returns 422.Response
8
Book a payout
Read your wallet address from
GET /dapi/v1/client/balance with userId from step 1 in X-Hevn-Account. Save it with POST /dapi/v1/contacts, then book 1.00 to it with POST /dapi/v1/payouts.Response
authorization: "client" means the holder approves this payout. Export the id as HEVN_PAYOUT_ID.A new Idempotency-Key books a second payout.9
Approve the payout
Call Sign in with the second Google account and approve the payout. The page shows:
POST /dapi/v1/connect/sessions with action: "sign" and the payout id, then open the URL from the page as in step 4.10
Read the payout
Do not act on the redirect. Poll In the ledger row,
GET /dapi/v1/payouts/{payoutId} until the status leaves awaitingSignature and submitted, then read GET /dapi/v1/transactions.Response
from and to are both 1.000000 USDC. To see the 1 USDC in your account, repeat step 7 with $HEVN_USER_ID in X-Hevn-Account.baseSmartWallet and a payout to a wallet contact need a ready client and no verification. Account details and bank payouts need a verified client and an active virtual account. A business verifies through a KYB application, and an individual in a verify session.