Settlement to EVM Contracts
For Merchants With Smart Contracts on EVM Chains: Learn How to Enable Settlement to a Contract or Wallet.
Overview
On-chain merchants with custom program logic can choose to settle directly to a smart contract or wallet. Coinflow requires these merchants to pass a transaction to our system. The following section explains how merchants can construct and submit a transaction compatible with their smart contracts.
Specifying Price
Coinflow supports making purchases in all liquid currencies, you can configure the following properties to select the token and the amount necessary to complete the purchase:
token - Address of the token which the purchase is denominated in (if using USDC leave this empty)
amount - Amount of that token necessary to complete the purchase
📘 If using ETH or MATIC please pass
0x0000000000000000000000000000000000001010
Waiting for Transaction Confirmation
By default Coinflow will show the user a success message as soon as the transaction has passed simulation and been submitted to the chain. Because of retry logic + time to confirm we recommend keeping this default behavior as it results in a better user experience.
In the case you want the user to wait until the transaction has confirmed on chain you can add waitForHash to the transaction object you pass to the Coinflow Purchase Component.
When waitForHash=true the onSuccess hook will also include the hash in its return data.
Example:
Specifying Transaction
There are multiple different ways of purchasing Goods and Services on EVM compatible blockchains via Coinflow. Each one is specific to what you as a company are selling and how your smart contracts work under the hood. Coinflow is designed for maximum flexibility and provides options so that your company does not need to change their smart contracts.
Ask yourself the following questions to determine which option is the best for you:
- Are you selling NFTs?
- Yes - Go to question 2
- No - Go to section Redeem with Custom Receiver Field
- Do you know the ID of the NFT being delivered to the user at the time of transaction creation?
- Yes - Go to section Known Token ID
- No - Go to question 3
- Does your program use SafeMint to mint the user an NFT?
- Yes - Go to section SafeMint
- No - Go to question 4
- Does your program return the NFT token ID in the first 32 bytes of the function call?
- Yes - Go to section Returned Token ID
- No - Go to section Redeem with Custom Receiver Field
Redeem with Custom Receiver Field
🚧 Merchant’s smart contracts might require changes
Your Smart Contract needs to implement the following functionality:
- The payer for the purchase (ERC-20 token), should be
msg.sender - The smart contract method must support a
receiverargument, which is the end-user’s wallet that is receiving the good or service.
When passing the transaction object to the Coinflow SDK or API’s please utilize the following format:
Known Token ID
If during transaction construction, your system knows the contract address and token ID of the NFT, you can specify the NFT Token ID and no changes to your smart contract are required. The Coinflow program will automatically forward the NFT to the customer’s wallet.
When passing the transaction object to the Coinflow SDK or API’s please utilize the following format:
SafeMint
If your contract implements Openzeppelin’s SafeMint function, then no changes are required to your contract. The Coinflow contract automatically determines the Token ID, and forwards the NFT to the user.
When passing the transaction object to the Coinflow SDK or API’s please utilize the following format:
Returned Token ID
If your contract returns the Token ID of minted NFT in the first 32 bytes of returnData, then no changes are required to your contract.
When passing the transaction object to the Coinflow SDK or API’s please utilize the following format:

