Overview
Mobile payment flows have a few requirements that differ from desktop web integrations:- Smaller screens: Payment flows must stay compact and easy to complete on one device
- Wallet handoff: Users may move between your app and a wallet app during the payment flow
- Secure backend usage: Session tokens must still be created server-side to keep your API key private
@chainrails/react-nativefor the mobile payment modal and hooks@chainrails/sdkon your backend to create payment sessions
If you need a broader overview of the session flow, see the Quickstart and the Payment Modal reference.
React Native
This guide uses React Native, but the same backend session endpoint pattern applies to any mobile app using the Chainrails SDK surface.Prerequisites
Before you begin, make sure you have:- A React Native project
- A Chainrails API key from dashboard.chainrails.io
- A backend service where you can create session tokens securely
- At least one mobile wallet installed for testing
Step 1: Install the SDK
Install the React Native UI package in your app and the core SDK on your backend.- App
- Backend
@chainrails/react-native to present the payment flow. Your server uses @chainrails/sdk to create session tokens.
Step 2: Set Up Session Endpoint
Create a backend endpoint that generates secure session tokens. The mobile app should call this endpoint right before opening the payment modal.recipient, destinationChain, token, and amount fields before creating a session.
Step 3: Initialize the Payment Modal
In your app, fetch a session from your backend and open the payment modal only after the session is ready.Best Practices
- Never expose API keys client-side: Always use a backend session endpoint
- Validate all inputs: Check recipient addresses, chains, tokens, and amounts
- Use HTTPS: Ensure all communications are encrypted
- Implement rate limiting: Prevent session endpoint abuse
Additional Notes
- Live API keys cannot be used with test networks. In test environments you can use supported mainnets and testnets, but once you switch to a live API key you must use mainnet networks only.
-
Testnets also do not have indexing support. If you are testing the modal on a testnet, users must click I have made payment after funding. If you are using API-driven flows, you must manually call
POST /api/v1/intents/{intent_address}/trigger-processingto process the intent.
Next Steps
- See the Payment Modal reference for hook behavior and parameters
- See the Quickstart for the shared session model used across web and mobile
Github Example
Check out our Github demo repository for an integration example.

