API reference for the MobileDeposit class. The core entry point for mobile SDK integrations.
The 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.
import { MobileDeposit } from '@swype-org/deposit-mobile';
Constructor
new MobileDeposit(config: MobileDepositConfig)
Creates a new 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).
Color scheme and deposit title visibility of the hosted UI. hideDepositTitle defaults to false; set it to true to hide deposit entry/status titles while keeping More and navigation titles. 'system' follows the device’s prefers-color-scheme as reported inside the in-app browser and flips live when it changes. There is no auto-detection on mobile — omitting this renders light. See Dark and light mode.
debug
boolean
false
Log lifecycle events to console.debug with the [SwypeMobileDeposit] prefix.
appearance is read when the instance builds the hosted-flow URL. To change the theme, call destroy() and construct a new MobileDeposit.
Opens the hosted deposit flow in an in-app browser. The returned Promise resolves when the user completes the payment (via deep link callback) and rejects with a 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.Pass minimumDeposit in the request to raise the minimum deposit in USD. It never lowers Blink’s route minimum. See Minimum deposit for validation, and Types for the full DepositRequest and DepositResult definitions.
handleDeepLink
deposit.handleDeepLink(url: string): boolean
Feed an incoming deep link URL to the SDK. Returns 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
deposit.on(event: EventName, handler: EventHandler): this
Register an event listener. Returns 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
deposit.off(event: EventName, handler: EventHandler): this
Remove a previously registered event listener. Returns this for chaining.
close
deposit.close(): void
Cancel the current flow. Rejects the pending promise with DEPOSIT_DISMISSED.
focus
deposit.focus(): void
No-op retained for API compatibility with @swype-org/deposit.
destroy
deposit.destroy(): void
Tear down the instance and release all resources. Clears all timers, removes all event listeners, and marks the instance as destroyed. Subsequent calls to requestDeposit will reject with INVALID_REQUEST.Call this on component unmount.
Properties
status
deposit.status: MobileDepositStatus
Current phase of the deposit flow. One of 'idle', 'signer-loading', 'browser-active', 'completed', or 'error'.
result
deposit.result: DepositResult | null
Last successful DepositResult, available when status === 'completed'.
error
deposit.error: DepositError | null
Last DepositError, available when status === 'error'.
isActive
deposit.isActive: boolean
true when a deposit flow is in progress (status is 'signer-loading' or 'browser-active').
Assistant
Responses are generated using AI and may contain mistakes.