Deposit class is the main entry point for the SDK. It manages the signer call, iframe lifecycle, and completion handling.
Constructor
Deposit instance. Throws a DepositError with code INVALID_REQUEST if config.signer is missing or not a string/function.
DepositConfig
| Property | Type | Default | Description |
|---|---|---|---|
signer | string | SignerFunction | required | URL string for the signer endpoint, or a custom async function. When a string, the SDK sends a POST with a JSON SignerRequest body. When a function, the SDK calls it with a SignerRequest and expects a Promise<SignerResponse>. |
environment | 'production' | 'sandbox' | 'production' | Blink environment to target. 'sandbox' points the hosted flow at the testnet sandbox (https://pay-sandbox.blink.cash). An explicit webviewBaseUrl takes precedence. |
webviewBaseUrl | string | 'https://pay.blink.cash' | Base URL of the hosted payment webview app. The SDK appends merchantId, payload, and signature as query parameters. Overrides environment when set. |
hostedFlowOrigin | string | Derived from webviewBaseUrl | Origin for postMessage validation. |
containerElement | HTMLElement | document.body | DOM element to mount the iframe overlay into. |
signerTimeoutMs | number | 15000 | Maximum milliseconds to wait for the signer to respond. |
flowTimeoutMs | number | undefined (no limit) | Maximum milliseconds for the entire flow (signer + user completion). |
enableFullWidget | boolean | true | Whether the hosted flow may show the full widget — the deposit options entry screen offering deposit addresses (pay from an exchange or any wallet) alongside Blink one tap. The full widget appears only when this is true and it is enabled on your Blink merchant account. Set to false to send users straight to the Blink one-tap flow. |
debug | boolean | false | Log lifecycle events to console.debug with the [BlinkDeposit] prefix. |
Methods
requestDeposit
DepositError on failure.
If a flow is already active, calling requestDeposit again cancels the previous flow and starts a new one.
Throws DepositError with code INVALID_REQUEST if the instance has been destroyed.
See Types for DepositRequest and DepositResult definitions.
on
this for chaining. See Events.
off
this for chaining.
close
idle and fires the close event.
destroy
requestDeposit will reject with INVALID_REQUEST.
Call this on component unmount or page unload.
focus
Properties
status
'idle', 'signer-loading', 'iframe-active', 'completed', or 'error'.
result
DepositResult, available when status === 'completed'.
error
DepositError, available when status === 'error'.
isActive
true when a deposit flow is in progress (status is 'signer-loading' or 'iframe-active').