createRampClient
The five functions
ramp.createSession(input)
POST /api/partner/v0/sessions (create), GET /api/partner/v0/sessions/{sessionRef} (status).
Return URL scheme. returnUrl must carry a letter-first scheme per RFC 3986 (mywallet://ramp, zingo:ramp, or https:). Digit-first schemes and values without a scheme prefix throw ConfigError before any POST; schemes without // are accepted; an absent returnUrl stays a no-op. Register the exact string — the server’s return-link allowlist compares the full value exactly: any added query string or fragment is rejected with 403 at session create. Enforced client-side — the wire schema and golden fixtures are unchanged.
ramp.attachPaneBridge(handlers)
PaneBridge with .close(), .sendZecSendResult(requestId, txid), .sendZecSendCancel(requestId, reason), .getStats().
ramp.getStatus(sessionRef, opts?)
{ statusTicket } explicitly if running more than 16 concurrent sessions or after a fresh client process.
ramp.restoreSession(saved)
Revalidates the full session and origin, restores the status ticket without a POST.ramp.parseReturnUrl(url)
null; only unparseable input throws InvalidReturnUrl.
ramp.isAllowedPaneUrl(url)
Returnsboolean. Checks against configured pane origins.
Draft handoff codec (browser-hosted mode)
DRAFT — unfrozen; first-partner integration in progress. The encoding may change and pane-side conformance is NOT claimed. Draft vectors live outside the frozen PSP-v1 conformance set. Do not build production flows on this encoding before it freezes.
@0xramp/sdk/session.
parseZecSendHandoffUrl(url, expected)
Parses a pane-to-wallet handoff link carrying the payment request: dedicated query params on your registered scheme (sessionRef, requestId, transparent address, canonical integer amountZat, optional memo). expected is required: pass { sessionRef } — links for any other session throw SessionMismatch, so a well-formed link is never accepted without binding it to your session.
A trailing
#fragment is ignored, never read as part of the query. The result is shape-compatible with ZecSendRequestPayload, so existing ZecSendStore claim/journal semantics apply unchanged (exactly-once, replay-safe). The parse is a payment request for your wallet’s native confirmation sheet — the SDK never signs.
buildZecSendResumeUrl(baseUrl, evidence)
Builds the wallet-to-pane resume URL: an existing pane or return URL plus advisory txid evidence astxid and/or comma-joined txids query params (1-32 individual 64-hex IDs; when both are given, txids must include txid). The 2048-character deep-link bound binds first: depending on the base URL, roughly 28-30 txids fit — larger evidence sets fail closed and reconcile via the status endpoint.
InvalidReturnUrl; missing evidence throws ConfigError; schema-violating values throw SchemaViolation. The result is evidence for the pane to reconcile — never an authoritative receipt; the ticketed status endpoint stays authoritative.
Bridge events (pane to host)
Envelope:{ v: 1, type, sessionRef, payload }
Host to pane replies
Transaction arrays: 1-32 individual 64-hex IDs. Evidence for reconciliation, not proof of settlement.
Send request payload
Session lifecycle
created -> opened -> user-active -> { settled | failed | expired | cancelled }
expired is reversible — keep the saved session and journal for late-deposit reconciliation.
Error codes
All SDK errors extendPspError. Branch on error.code, never on message text.
Versioning
0.x until pilot completes. PSP-v1 frozen at 0.1.0: additive changes only afterward. Breaking change = new envelope version (psp/v2). ESM, strictly typed, React-free. Targets React Native, Electron, browsers.