Checkout class is the main entry point for the SDK. It manages the signer call, iframe lifecycle, and completion handling.
Constructor
Checkout instance. Throws a CheckoutError with code INVALID_REQUEST if config.signer is missing or not a string/function.
CheckoutConfig
| 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>. |
webviewBaseUrl | string | 'https://pay.tryblink.xyz' | Base URL of the hosted payment webview app. The SDK appends merchantId, payload, and signature as query parameters. |
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). |
debug | boolean | false | Log lifecycle events to console.debug with the [BlinkCheckout] prefix. |
Methods
requestDeposit
CheckoutError on failure.
If a flow is already active, calling requestDeposit again cancels the previous flow and starts a new one.
Throws CheckoutError 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
CheckoutError, available when status === 'error'.
isActive
true when a deposit flow is in progress (status is 'signer-loading' or 'iframe-active').