Settlement to EVM Contracts
For Merchants With Smart Contracts on EVM Chains: Learn How to Enable Settlement to a Contract or Wallet.
For Merchants With Smart Contracts on EVM Chains: Learn How to Enable Settlement to a Contract or Wallet.
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.
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
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:
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:
🚧 Merchant’s smart contracts might require changes
Your Smart Contract needs to implement the following functionality:
msg.senderreceiver argument, 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:
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:
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:
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: