Step 1 — Request a Quote
Before creating a payment intent, you need to request for quotes to help the user understand the costs for the multiple cross-chain routes available.- We often recommend using the multi-source quote endpoint to get quotes from multiple source chains for a given destination chain. This fetches the best quotes for multiple source chains, providing more options for the user. See Multi-Source Quotes for more details.
- cURL
- JavaScript
- PHP
Step 2 — Curate a Payment Intent
Once the user chooses a route (from the generated quotes), prepare a payment intent payload that defines:- The selected route/chain
- The total amount to be sent
- The destination chain and recipient
Payment Intent
Step 3 — Create the Payment Intent
Call thePOST /api/v1/intents endpoint with the curated payment intent.
- cURL
- JavaScript
- PHP
Sample Response
Step 4 — User Funds the Payment Intent
Display the intent deposit address to the user on your payment screen. The user should send the exacttotalAmount from their wallet on the selected source chain.
Once the funds are detected on-chain, the Chainrails protocol takes over.
Step 5 - Automated execution
After the deposit is confirmed, Chainrails:- Starts the intent automatically
- Prefills the transaction on the destination chain for the end user
- Refunds the relayer, who provided the liquidity to prefill the cross-chain execution, or
- Refunds the user if the intent expired without initiating.
GET /api/v1/intents/{intent_address}/trigger-processing endpoint.
Step 6 - Track Status via Webhooks
You can subscribe to webhooks to receive real-time updates on the intent’s lifecycle, including:intent_fundedintent_initiatedintent_completedintent_refunded
Additional Tips
- Intent addresses are like one-off account numbers, they can’t be reused, so a new one is generated for every intent.
- If the user under-funds the intent, the transaction will fail to start, and the user can either top up the balance of the intent address, or a refund will be processed after intent expiration.
- If the user over-pays an intent, the excess is refunded on intent initiation.
- API keys have a rate limit of 250 rps, contact the team if you need modifications to this.
Github Example
Check out our Github demo repository for copy-paste code examples.

