Skip to main content

Overview

Chainrails gives you a single payment modal that supports both:
  • Crypto deposits from supported chains and tokens
  • Fiat deposits from 70+ countries
This quickstart is focused on getting the modal live in minutes. You will install the SDK, create a secure session endpoint, and open the modal from your app.

Get started in three steps

This quickstart uses the React web SDK. If you’re building for React Native, use @chainrails/react-native with the same backend session endpoint pattern described below.
1

Installation

Install the UI SDK for your app and the core SDK for your backend session endpoint.
2

Set up a Session Endpoint

Create a backend endpoint that generates secure session tokens. This keeps your API key private and lets you control payment defaults.
Here’s a curated Github template to help you get started quickly: Chainrails Demo Server
Where:
  • recipient: Wallet address that receives settled funds.
  • amount: Target amount. Leave empty or set to 0 to let users enter an amount in the modal.
  • destinationChain: Chain where funds should settle.
  • token: Asset to receive on settlement.
These defaults work for both crypto and fiat deposit journeys in the modal.
3

Initialize the Payment Modal

Initialize the modal in your app and trigger it from a button.
Parameters:
  • session_url: Your server endpoint for creating payment sessions.
  • excludeChains (optional): Array of chains to exclude from payment options.
For deeper configuration options, see the Payment Modal documentation.

What happens next?

When a user opens the modal:
  1. The SDK fetches a secure session token from your backend
  2. The modal presents available payment methods
  3. Users can complete a crypto deposit from supported chains/tokens or a fiat deposit through supported ramp providers
  4. Your onSuccess callback fires when the transaction completes
  5. Funds settle to your configured recipient and destination chain

Additional Notes

  1. Live API keys cannot be used with test networks. In test environments you can use supported mainnets and testnets, but live API keys must use mainnet networks only.
  2. Testnets do not have indexing support. In modal flows, users must click I have made payment after funding on testnets. In API-driven flows, use POST /api/v1/intents/{intent_address}/trigger-processing to process the intent manually.

View Github Code

Explore a complete Payment Modal example in our Github repository.