Skip to main content

Split-Fee Implementation

Split-Fee Transaction as a User

The new split-fee feature introduces the possibility to have a designated account pay the gateway fees for the transactions of another account. This feature is used by defining the payer details in the options field when creating an instance of the API.

Options can include:

  • suri (optional): The mnemonic or secret seed of the user. If it's empty, the value is read from AVN_SURI environment variable.
  • hasPayer (optional): A user specified flag used to determine if there is a configured payer for this user. If not defined, this defaults to false and the api will treat this transaction as a "self pay" transaction, requiring the signer to pay for the gateway fees.
  • payerAddress (optional): The payer address for this user. Defaults to the first payer configured for this user.
const options = 
suri: "0x5392ca60a61aea99fce14358798de93c1bc11c3696a905718738c71fae539c24",
hasPayer: true,
payerAddress: "5EYzWhGxbogEfwNKL52ZRDCgBxu4t8oWDFAsXXVYvH6dMQTo",
const API = new AVN_API("", options);

Example Implementation

const AVN_API = require("avn-api");
const AVN_GATEWAY_URL = "";

// Do not use this account to handle funds.
const options = {
suri: "0x226beb8ff69a053e0f101944d4c917819f7b9e44f1d915f3cf30dc97844262e0",
hasPayer: true,

const API = new AVN_API(AVN_GATEWAY_URL, options);

const AVN_RELAYER = "5Fb...yTh";

// This can be the address or public key.
const RECIPIENT_ADDRESS = "5DA...gxV";

// The token address on Ethereum.
const TOKEN_ETHEREUM_ADDRESS = "0x2a...b0e";

//amount of the token in 18 decimals.
const TOKEN_AMOUNT = "1234000000000000000"; //i.e. 1.234 of a token

async function main() {
await API.init();

let result = await API.send.transferToken(
// Returns a request id

(async () => {
await main();

Setting up Split Fee as a Payer

Before setting up users to send transactions with the option flags stated above, there are a few steps required.

Register your payer account

An account on the Aventus network needs to be registered "as a payer". Currently, the registration process requires you to reach out to Aventus to create a new payer account on the Gateway.


The Gateway will hold the SURI for the account to ensure it can process the payments on the account when required.

Upon creating the account, you'll be required to fund the account with AVT, ensuring the account can pay for your user's transactions.

Register your users

To register your users, we'll provide you with a portal where you can log in with a username and password. Upon logging in for the first time, you'll have the option to generate a new password. This portal will allow you to manage users i.e. add and remove your users. We'll walk you through the process of adding users during the onboarding stage. Setting up user's on the gateway does not cost any AVT.


You cannot pay for the transactions of any user not added here. This is to protect payers from paying for users they don't know about, giving payers full control of who they want to pay for.

Once a user has been added, the user can set the options flag stated above allowing the designated payer pay for its transactions.


Once a user has been registered on the Gateway to have a payer, the user only needs to set the hasPayer field to true. The user doesn't need to add the payerAddress field as the Gateway will automatically identify the payer for the user.