Link a user
Linking follows the familiar code-and-PKCE pattern: your server starts a request, the user approves it inside NEDApay, and your server swaps a one-time code for tokens.
1. Start, on your server
First make a PKCE pair: code_verifier is 43 to 128 random URL-safe characters, and code_challenge is base64url(SHA-256(code_verifier)). Keep the verifier on your server.
/link-requests{ "scopes": ["balances", "transactions", "stocks"],
"redirect_uri": "<one of your registered return addresses>",
"state": "<8 or more random characters you will check later>",
"code_challenge": "<challenge>",
"code_challenge_method": "S256" }{ "request_id": "...",
"link_url": "https://app.nedapay.xyz/connect/link/...",
"expires_at": "..." }Ask only for the scopes your feature needs: balances, transactions, stocks.
2. Send the user to link_url
It is valid for 10 minutes. The user sees what you asked for and approves inside NEDApay. Only fully verified NEDApay accounts can link.
With a test key, skip this step and approve the request yourself: see Sandbox. For where the link opens on each kind of device, see Going live.
3. The user comes back
They arrive at your redirect_uri with ?code=...&state=..., or with ?error=access_denied&state=... if they declined. Check that state is the one you sent.
4. Swap the code, on your server
Within 60 seconds. A code works once.
/token{ "grant_type": "authorization_code", "code": "...",
"code_verifier": "...", "redirect_uri": "..." }{ "access_token": "nca_…", "token_type": "Bearer", "expires_in": 900,
"refresh_token": "ncr_…", "link_id": "...",
"scopes": ["balances", "transactions", "stocks"],
"consent_expires_at": "..." }5. Refresh
Refresh before the access token expires (15 minutes). Each refresh token works once, so store the new one every time. Using an old refresh token again ends the link.
/token{ "grant_type": "refresh_token", "refresh_token": "ncr_…" }consent_expires_at); after that the user links again. The user can remove the link at any time in NEDApay, and your next call then answers 401 LINK_REMOVED. A user has one link to you at a time: linking again replaces the earlier one.Ending a link from your side
/linkCall this when a user disconnects in your app or deletes their account with you, so their access ends on our side too. It needs the signature headers and the user's access token.