Settlement to Stellar Contracts
For Merchants With Smart Contracts on Stellar: Learn How to Enable Settlement to a Soroban Contract.
Overview
On-chain merchants with custom Soroban contract logic can choose to settle directly to a smart contract on the Stellar network. Coinflow requires these merchants to pass a transaction to our system as a base64-encoded XDR string. The following section explains how merchants can construct and submit a transaction compatible with their Soroban contracts.
How It Works
When a customer makes a purchase on Stellar, Coinflow’s checkout contract executes a mint_and_redeem call that:
- Approves USDC — The Coinflow checkout contract approves a USDC allowance to your merchant contract based on the purchase subtotal
- Invokes your contract — Coinflow calls your merchant contract’s function with the parameters you specified in the transaction
- Your contract transfers USDC — Your merchant contract uses
transfer_fromto move USDC from the Coinflow contract to your treasury
This means your merchant contract receives a USDC allowance and is responsible for pulling the funds using the Soroban token transfer_from function.
Stellar checkout does not support Credits settlement or partial purchases where the customer contributes their own USDC alongside a credit card payment.
Specifying the Transaction
Pass your Soroban contract invocation as a base64-encoded XDR string in the stellarTransaction field. Coinflow will automatically extract the contract address, function name, and arguments from your transaction.
Step 1: Generate TypeScript Bindings
Use the Stellar CLI to generate TypeScript bindings for your Soroban contract:
This generates a typed TypeScript client you can use to build transactions.
Step 2: Build the Transaction
Use the generated client to build a transaction that invokes your contract function:
Step 3: Convert to Base64 XDR
Convert the assembled transaction to a base64-encoded XDR string:
Step 4: Pass to Coinflow
Pass the XDR string as stellarTransaction in your checkout request:
Or via the API:
Merchant Contract Requirements
Your Soroban smart contract function should follow this pattern:
- Accept
payer(the Coinflow checkout contract address) andrecipient(the customer’s wallet) as parameters - Use the Soroban token client’s
transfer_fromto pull USDC from the Coinflow contract - Deliver the purchased item to the
recipient
Example: NFT Purchase Contract (Rust)
The payer parameter should always be the Coinflow checkout contract address. Coinflow approves your contract to spend USDC on its behalf before invoking your function.
Gas-Only Purchases
If your contract charges $0 USDC for the purchase (e.g., free mints, promotional items), Coinflow will only pay the Stellar gas fees to execute the transaction on your contract. Your contract function does not need to handle any USDC transfer logic in this case.
For gas-only purchases, pass subtotal: { cents: 0 } in your checkout request. The customer is only charged for the gas fees.
Gas Fee Handling
Coinflow automatically simulates your Stellar transaction to estimate gas fees. These fees are added to the customer’s total purchase price. The merchant does not need to handle gas fees or fund any wallets with XLM.
Whitelisting Your Contract
Before your contract can receive settlement, it must be whitelisted by Coinflow. Submit your contract address through the Coinflow Merchant Dashboard.
Your contract must be whitelisted on both sandbox and production environments separately. Start with sandbox for testing.
For more details on the whitelisting process, see How to Whitelist Your Contract.

