ContactlessCryptoSDK.initialize()
Callinitialize() once at app startup — before rendering any components that use TapRails hooks or the PaymentFlowManager.
SDKConfig
Fields
Your TapRails API key. Use
pk_test_... for sandbox and pk_live_... for production. Do not commit this to version control — load from environment variables or a secrets manager.Base URL of your TapRails backend instance (e.g.,
https://api.yourcompany.com). No trailing slash.Controls which environment header is sent with API requests. Use
sandbox during development.Your merchant identifier. Required when the app operates in merchant mode (accepting payments). Can be overridden per-call in
useNFCMerchant.Payment mode —
PaymentMode.POOL or PaymentMode.SESSION_KEY. See Payment Modes.Configuration for POOL mode. Provide
customerId to identify the paying customer.Configuration for SESSION_KEY mode. Provide the user’s wallet address, daily limit, and transaction signer callback.
PoolConfig
The identifier for the customer in your TapRails dashboard. Used to debit from the correct pool wallet.
SessionKeyConfig
The user’s onchain wallet address (e.g.,
0x1234...abcd). This is the wallet that funds payments.Maximum USDC spend per day via the session key, as a decimal string (e.g.,
"100.00").If
true, when a session key expires the SDK automatically triggers re-setup before the next payment.Session key validity duration in milliseconds. Defaults to 24 hours if not specified.
Callback invoked when the user must sign the ERC-20 approval transaction to create a session key. Integrate with your wallet provider (e.g., WalletConnect, Privy, Magic). Return the signed transaction hash.
Optional callback invoked when session key setup completes successfully.
Optional callback invoked when the user cancels session key setup.
ApprovalTransaction
Passed toonSignTransaction:
Other Methods
ContactlessCryptoSDK.getConfig()
Returns the currentSDKConfig. Throws APIError with code SDK_NOT_INITIALIZED if called before initialize().
ContactlessCryptoSDK.isInitialized()
Returnstrue if initialize() has been called, false otherwise.

