Developer Quick-Start: Custom Token Fees | Hedera Hedera Network Services Token Service Mint and configure tokens and accounts. Consensus Service Verifiable timestamps and ordering of events. Smart Contracts Run Solidity smart contracts. HBAR The Hedera network's native cryptocurrency. Insights How It Works Learn about Hedera from end to end. Explorers View live and historical data on Hedera. Dashboards Analyze network activity and metrics. Network Nodes Understand networks and node types. Devs Start Building Get Started Learn core concepts and build the future. Documentation Review the API and build using your favorite language. Developer Resources Integrations Plugins and microservices for Hedera. Fee Estimator Understand and estimate transaction costs. Open Source Hedera is committed to open, transparent code. Learning Center Learn about web3 and blockchain technologies. Grants Grants & accelerators for your project. Bounties Find bugs. Submit a report. Earn rewards. Ecosystem ECOSYSTEM Hedera Ecosystem Applications, developer tools, network explorers, and more. NFT Ecosystem Metrics Analyze on-chain and market NFT ecosystem metrics. CATEGORIES Web3 Applications Connect into the innovative startups decentralizing the web on Hedera. Enterprise Applications Learn about the Fortune 500 companies decentralizing the web on Hedera. Wallets & Custodians Create a Hedera account to manage HBAR, fungible tokens, and NFTs. Network Explorers Hedera mainnet and testnet graphical network explorers. Developer Tooling Third-party APIs, integrations, and plugins to build apps on Hedera. Grants & Accelerators Boost your project with support from the Hedera ecosystem. Partner Program Explore our partners to bring your vision into reality. Hedera Council Over 30 highly diversified organizations govern Hedera. Use Cases Hedera Solutions Asset Tokenization Studio Open source toolkit for tokenizing assets securely. Stablecoin Studio All-in-one toolkit for stablecoin solutions. Hedera Guardian Auditable carbon markets and traceability. Functional Use Cases Data Integrity & AI Reliable, secure, and ethically governed insights. Sustainability Enabling fair carbon markets with trust. Real-World Asset Tokenization Seamless tokenization of real-world assets and digital at scale. Consumer Engagement & Loyalty Mint, distribute, and redeem loyalty rewards. Decentralized Identity Maintain the lifecycle of credentials. Decentralized Logs Scalable, real-time timestamped events. DeFi Dapps built for the next-generation of finance. NFTs Low, fixed fees. Immutable royalties. Payments Scalable, real-time, and affordable crypto-payments. HBAR Overview Learn about Hedera's token, HBAR. Treasury Management Hedera’s report of the HBAR supply. Governance Decentralized Governance Hedera Council See the world's leading organizations that own Hedera. About Meet Hedera's Board of Directors and team. Journey Watch Hedera's journey to build an empowered digital future for all. Transparent Governance Public Policy Hedera's mission is to inform policy and regulation that impact the industry. Meeting Minutes Immutably recorded on Hedera. Roadmap Follow Hedera's roadmap in its journey to build the future. Resources Company What's New Partners Papers Careers Media Blog Technical Press Podcast Community Events Meetups Store Brand Navigation QUICKSTART Developer Quick-Start: Custom Token Fees technical Sep 02, 2021 by Waylon Jepsen Developer Evangelist by Francesco Coacci Developer Evangelist The Hedera mainnet was upgraded to v0.17.4 on September 2nd, 2021. It included the new functionality of HIP-18: Custom Hedera Token Service Fees — the ability for anyone issuing a token on Hedera using the Hedera Token Service to include programmatic custom fees. Custom fees can be `fractional`, `fixed`, or `royalty`: Fixed Fee: A fixed fee transfers a set number of tokens, collected as a fee, every time a token transfer is initiated. Fractional Fee: A fractional fee transfers a variable number of tokens, collected as a fee, every time a token transfer is initiated. The amount is configured by setting a numerator and denominator to determine a fractional (or percentage) fee. Fractional fees can be configured to impose minimum and maximum limits on the amount transferred. Royalty Fee: A royalty fee can be enabled on the fee schedule of an NFT and collected during the transfer of ownership. This fee is defined as a fraction of the fungible token value used in exchange (HBAR or a custom fungible token) for the NFT, as defined by the fee schedule of the NFT. The fee is collected from the receiver of the NFT in a transaction and sent to the NFT’s fee collector account, as defined in the fee schedule. Fees are configured to be paid in the token being transacted, any other type of token created using Hedera Token Service, or hbar. In this blog posting, we’re going to outline specific application use cases for custom token fees and code examples to help you get started. The official Hedera SDKs in Java, Javascript, and Go all support custom token fees; you can read the full documentation here. Custom Token Fee Use Cases and Code Examples Here are some JavaScript examples (below) of how you can use the new custom fee features. The features we will go over are creating the fee schedules either with CustomeFractionalFee(), or CustomFixedFee(), or CustomRoyaltyFee() and then the inclusion of these fee schedules in the TokenCreateTransaction(). Custom Fractional Fee Schedule The new fractional fee schedule is represented by the CustomFractionalFee() object. The object has a numerator attribute, a denominator attribute, and a collector account attribute. The numerator and denominator attributes make up the fraction for the fractional fee. The below snippet is an example of how to make a fractional fee schedule of 10% in JavaScript. var fractionalFeeExample = new CustomFractionalFee() .setNumerator(1) // Numerator of fractional fee .setDenominator(10) // Denominator of fractional fee .setFeeCollectorAccountID(operatorID) // Collector account Custom Fixed Fee Schedule The new fixed fee schedule is represented by the CustomFixedFee() object. The object has a denominating token attribute, an amount attribute, and also collector account attribute. The denominating token attribute takes a tokenID and if left empty will default to hbar. The below snippet is an example of how to make a fixed fee schedule of 5 hbars in JavaScript. var fixedFeeExample = new CustomFixedFee() .setDenominatingToken() // Empty for hbar .setAmount(5) // Fee amount .setFeeCollectorAccountID(operatorID) // Collector Account Including your fee schedule in a new token Now that we have gone over how to create the new fee schedules, we will give an example of how to include them in your new token when using the TokenCreateTransaction object. All you have to do is include the .setCustomFees() passing in the fee schedule you have recently created. The below code snippet is an example of how to set the fee schedule to the fractional fee defined above for 10%. The TokenCreateTransaction() can take up to 10 custom fee schedules. var creaTokenTX = await new TokenCreateTransaction() .setTokenName(“Cookie”) // The public name of the token .setTokenSymbol(“CRUNCH”) // The public symbol of the token .setDecimals(4) // Amount of decimals for the token .setCustomFees([fractionalFeeExample]) Details & Limitations A fungible token’s fee schedule can include a combination of both fractional and fixed fees. Negative fixed or fractional fee values are not allowed. The token’s treasury account and fee collector account(s) are exempt from paying fees to transfer said token. If the sender or receiver account configured does not have enough tokens to pay the fee(s) (plus the amount being transferred), the transaction will fail. A single transfer transaction cannot alter more than 20 account balances. A debit of tokens from one account and credit to another is equal to 2 account balance alterations. Only two ‘layers’ of custom HTS fees are allowed. In other words, a token being transferred may have a custom fee schedule (first layer) which requires you to pay fees in another token that has its own fee schedule (second layer). If that’s the case, a token paid as a fee within the second layer cannot have its own fee schedule — otherwise, that would create a third layer. For more information visit the official Hedera documentation or reach out to me at @HogwoodWaylon if you have any specific questions on how to utilize the custom fee features in the SDK. Updates With the upcoming mainnet upgrade to v0.31 (November 10th, 2022) and the introduction of HIP-573, a token creator can exempt all fee collectors from paying custom fees when exchanging token units. Check out this article if you want to learn more. Share This Back to blog What is gRPC, gRPC-Web, and Proxies? Ed Marquez Pragmatic Blockchain Design Patterns – Integrating Blockchain into Business Processes Michiel Mulders Zero Cost EthereumTransaction on Success: Hedera's New Fee Model for Relay Operators Oliver Thorn Hedera Adopts Chainlink Standard for Cross-Chain Interoperability To Accelerate Ecosystem Adoption Hedera Team Hedera Developer Highlights March 2025 Michiel Mulders Hedera Release Cycle Overview Ed Marquez View All Posts Sign up for the newsletter CONNECT WITH US Transparency Open Source Audits & Standards Sustainability Commitment Carbon Offsets Governance Hedera Council Public Policy Treasury Management Meeting Minutes LLC Agreement Node Requirements Community Events Meetups HBAR Telegram Developer Discord Twitter Community Support FAQ Network Status Developer Discord StackOverflow Brand Brand Guidelines Built on Hedera Logo Hedera Store About Team Partners Journey Roadmap Careers Contact General Inquiry Public Relations © 2018-2025 Hedera Hashgraph, LLC. All trademarks and company names are the property of their respective owners. All rights in the Deutsche Telekom mark are protected by Deutsche Telekom AG. All rights reserved. Hedera uses the third party marks with permission. Terms of Use  |  Privacy Policy