Developer guide

    How to Send ETH to a Payable Contract Function

    Payable functions receive native currency through msg.value — a field on the transaction, not an argument in the ABI. That distinction is where most failed mints, deposits and buys come from.

    msg.value Is Not an Argument

    A function marked payable in the ABI ("stateMutability": "payable") can accept native currency alongside its call. The amount travels in the transaction's value field and appears inside the contract as msg.value.

    function mint(uint256 quantity) external payable {
        require(msg.value == price * quantity, "wrong payment");
    }
    
    // the call carries BOTH:
    //   calldata -> mint(3)
    //   value    -> 0.24 ETH

    Sending a payable call with zero value is legal at the protocol level — the contract's own require is what rejects it. Conversely, attaching value to a non-payable function always reverts.

    Doing It in ABI Page Builder

    1. Generate a page for the contract and open the Write tab.
    2. Payable functions are marked with a payable badge and render an extra Value field, labelled with the chain's native currency — ETH, BNB, MATIC, CORE, whatever the network actually uses.
    3. Enter the amount in whole units (0.05, not 50000000000000000); it is converted to wei for you.
    4. Your connected wallet's balance is shown next to the field. If the value exceeds it, the send button is blocked before you waste gas on a certain failure.
    5. Fill the normal arguments, send, and read the decoded result or revert reason on the same card.

    Getting the Amount Right

    1 ETH      = 1000000000000000000 wei  (1e18)
    0.1 ETH    = 100000000000000000
    0.05 ETH   = 50000000000000000
    1 gwei     = 1000000000

    If a contract exposes price(), mintPrice() or cost(), read it first and multiply by quantity rather than trusting a number from a Discord message. The read costs nothing.

    Common Failures

    • Off-by-a-decimal value — 0.005 instead of 0.05 fails the price check; the reverse overpays if the contract does not refund.
    • Exact-match requires: some contracts demand msg.value == price exactly and revert on overpayment.
    • Non-payable function with value attached — always reverts, no matter the amount.
    • Native currency vs a wrapped token: depositing WETH is an ERC-20 transfer, not msg.value.
    • Balance must cover value plus gas. A balance exactly equal to the value leaves nothing for fees.
    • Plain transfers to a contract with no receive() or payable fallback revert with empty data.

    👉 Need to call a payable function with value?

    Build a contract page

    Related Guides