MobileDeposit class is the main entry point for the mobile SDK. It manages the signer call, in-app browser lifecycle, deep link handling, and completion detection.
Constructor
MobileDeposit instance. Throws a DepositError with code INVALID_REQUEST if any required config field is missing or invalid.
MobileDepositConfig
| 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>. |
callbackScheme | string | required | Custom URL scheme registered by the mobile app (e.g. 'myapp'). The hosted flow redirects to {callbackScheme}://swype/callback?... on completion. |
openUrl | (url: string) => Promise<void> | required | Function that opens a URL in an in-app browser. Use expo-web-browser, SFSafariViewController (iOS), or CustomTabsIntent (Android). The returned promise should resolve when the browser is dismissed. |
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. Overrides environment when set. |
callbackPath | string | '/swype/callback' | Path component of the callback deep link. |
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 [SwypeMobileDeposit] prefix. |
Methods
requestDeposit
DepositError on failure.
The merchant must listen for incoming deep links and pass them to handleDeepLink() for the promise to resolve.
If a flow is already active, calling requestDeposit again cancels the previous flow and starts a new one.
See Types for DepositRequest and DepositResult definitions.
handleDeepLink
true if the URL was a valid Blink callback and the SDK handled it, false if the URL did not match the expected callback pattern.
Call this from your deep link listener (e.g. Linking.addEventListener('url', ...)).
on
this for chaining.
| Event | Handler signature | When |
|---|---|---|
complete | (result: DepositResult) => void | Payment completed successfully. |
error | (error: DepositError) => void | Payment failed. |
close | () => void | In-app browser closed or the flow was cancelled. |
dismiss | () => void | Deprecated alias for close. |
status-change | (status: MobileDepositStatus) => void | Status changed. |
off
this for chaining.
close
DEPOSIT_DISMISSED.
focus
@swype-org/deposit.
destroy
requestDeposit will reject with INVALID_REQUEST.
Call this on component unmount.
Properties
status
'idle', 'signer-loading', 'browser-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 'browser-active').