Fund Algorand inner transactions through the outer group fee

A public application that pays a fee from its own account for every inner transaction can lose its operating balance under repeated calls. Specify the fee payer when designing the group.

Set the inner fee on every relevant path

This TEAL fragment is the body of a payment from the application to the first foreign account in a compatible app call. It explicitly sets the inner fee to zero. Wrap the payment in your application’s authorization and business checks before using it in a callable method.

itxn_begin
int pay
itxn_field TypeEnum
txna Accounts 1
itxn_field Receiver
int 5000
itxn_field Amount
int 0
itxn_field Fee
itxn_submit

Size the outer fee for the actual execution path

With one outer app call and two zero-fee inner transactions, the pool must cover three transactions. At an applicable minimum of 1000 microAlgos each and with no higher size-based requirement, the total is 3000. Include every outer transaction in the group and every inner transaction reached by the branch. The app still needs funds for payment amounts and minimum-balance obligations.

Sources