Traditionally transactions are paid for by the executor of the transaction however, there are usecases where it could be beneficial for there to be a separate or designated payer. For example, a company preferring to pay the fees for their user's transactions. Hence, split-fees.
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.
Currently, only companies can register to become payers on the Gateway.
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.
There is a detailed process here on how companies can register their users using the dashboard.
Register your users
To register your users, you can use this API where you can generate a token using your username and password. Registering users on the gateway does not cost any AVT.
You cannot pay for the transactions of any user not added. 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.