Overview
Mini-apps present unique integration challenges:- Constrained viewport: Limited screen real estate requires compact UI components
- Embedded context: Apps run inside Farcaster, Telegram or other platforms
- Simplified UX: Users expect one-tap or minimal-interaction flows
- Platform constraints: Must adhere to platform-specific guidelines and limitations
- Pre-built Payment Modal: Compact, responsive UI that works in constrained viewports
- Session-based Authentication: Secure, stateless payment sessions
- Deep Linking Support: Seamless handoff between mini-app and wallet apps
- Platform SDKs: Native integration with Farcaster SDKs
Farcaster MiniApps
This guide walks you through integrating Chainrails payments into a Farcaster MiniApp using the React SDK.Overview
Farcaster MiniApps are web applications that run within the Farcaster ecosystem. Chainrails provides a React SDK that works seamlessly with MiniApps to accept cross-chain payments.Prerequisites
- A Farcaster MiniApp project
- Chainrails API key (get one from dashboard.chainrails.io)
- A backend server to create session tokens
Step 1: Install the SDK
Step 2: Set Up Session Endpoint
Create a backend endpoint that generates secure session tokens. This protects your API key.Step 3: Initialize the Payment Modal
In your MiniApp, initialize the Chainrails payment modal: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.
Github Example
Check out our Github demo repository for a mini-app example.

