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:
| Field | Type | Description |
|---|---|---|
forwarder | string | FeeForwarder contract address that pulls the fee |
collector | string | Destination for the relayer’s reimbursement |
token | string | The fee token (echoes your config) |
estimatedXlmFee | string | XLM the relayer fronts for the transaction fee |
tokenAmount | string | Amount owed by the payer in token |
expiresAtLedger | number | Ledger number after which the quote is invalid |
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.

