Skip to main content
gas: { mode: "token", token } lets the payer settle the Soroban fee in USDC rather than holding XLM. The facilitator still fronts the actual XLM gas; the FeeForwarder contract reimburses it from the payer’s stablecoin balance atomically. Choose this mode when you want the user, not your sponsor, to cover the fee in the asset they already hold. For the sponsor-pays default, see Gasless modes.

Configuration

How it settles - one signature

prepare() calls POST /fee/quote, which returns a FeeQuote: The engine builds a single FeeForwarder.forward(payer, token, merchant, payment, collector, fee) invocation - one authorization entry that pays the merchant and reimburses the relayer’s XLM gas at the same time. The payer signs once; there is no second entry to approve.

The maxFee ceiling

maxFee (optional, in stroops) is a hard cap on the quoted fee. If tokenAmount from the quote exceeds maxFee, prepare() throws BuckspayError("TOKEN_GAS_REJECTED") before anything is signed. A fee surge can never surprise the user at signing time. Omit maxFee to accept the facilitator’s quote as-is.

Full example

Next

Gasless modes

Overview of the GasConfig union and when to use each mode.

Atomic batch

Settle multiple transfers in one all-or-nothing transaction.