Exact Buy now live on 0x Swap API
Pass buyAmount on any Swap API request to specify an exact output amount.
June 18, 2026
Feature Release

The 0x Swap API now accepts a buyAmount parameter for guaranteed-output swaps. A payment provider sets the exact amount the merchant receives, and 0x sizes and routes the input to deliver it.
Consider a merchant invoicing 500 USDC. The buyer holds ETH. On most swap infrastructure a provider approximates how much ETH to sell and accepts whatever USDC the swap delivers at settlement. The provider has to estimate the input and write fallback logic for the times the output lands short.
Now with Exact Buy, the provider sets the exact output, and 0x sizes and routes the input to deliver it. The merchant, set as the recipient, receives exactly 500 USDC.
How it works
Send buyAmount on a price or quote request in place of sellAmount. The response sizes the input and returns maxSellAmount, the ceiling the taker needs to cover in balance and allowance.
The swap acquires at least buyAmount and converts any surplus back to the sell token, returning it to the taker in the same transaction.
To deliver an exact amount to a merchant or third-party address, set buyAmount alongside recipient — the recipient receives exactly buyAmount while any unspent sell token is returned to the taker, all in one transaction.
const params = new URLSearchParams({
chainId: "8453",
sellToken: "0xEeeee...", // ETH
buyToken: "0x833...", // USDC
buyAmount: "500000000", // exactly 500 USDC (6 decimals)
taker: "0xUSER_ADDRESS",
recipient: "0xMerchantAddress" // merchant receives exactly 500 USDC
});
const response = await fetch(
`https://api.0x.org/swap/allowance-holder/quote?${params}`,
{
headers: {
"0x-api-key": process.env.ZEROX_API_KEY!,
"0x-version": "v2",
},
},
);
const quote = await response.json();What to know
- Exact-sell swaps are unchanged.
buyAmountis opt-in and takes the place ofsellAmounton a request, so existing integrations keep working. - The taker authorizes a ceiling,
maxSellAmount, not a fixed input, and the merchant receives exactlybuyAmount. - The
recipientparameter delivers thebuyTokento any address and defaults to the taker. buyAmountis not supported for wrap and unwrap operations (e.g. ETH <> WETH). UsesellAmountfor those cases.- Exact Buy is live on every EVM chain the Swap API supports.
Use cases
- Merchant checkout: A buyer at checkout pays with any token in their wallet. The merchant receives the exact invoice amount in a preferred stablecoin.
- Invoicing and bill pay: A provider settles an existing bill. The merchant gets the precise amount due, with no rounding or shortfall.
- Fixed-amount payouts: A platform pays a set figure to a contractor or seller regardless of which asset the treasury holds.
- Subscriptions: A consumer app charges a fixed price each cycle while users hold whatever asset they already have.
See the guide for the full API reference & examples.
Start building for free by signing up through the 0x dashboard.
Contents
Subscribe to newsletter