Monetize crypto trading in your app with Swap API

Discover how you can leverage Swap API to unlock new revenue streams.

October 26, 2023

Learn & Build

As Web3 matures from small projects to robust businesses, companies are not only thinking about building the best experience but also how to generate revenue to sustainably invest in their technology and deliver the most value to users.

Swap API offers Web3 teams low-friction ways to monetize their products. With Swap API, you can unlock new revenue streams by easily tapping into affiliate fee and trade surplus features. Regardless of whether you’re on a free or paid plan, monetization options are available to all integrators.

Swap API enables your users to easily and conveniently trade tokens at the best prices directly in your app. With one simple integration, 0x unlocks thousands of tokens on the most popular blockchains and aggregated liquidity from 100+ AMMs and professional market makers.

In this guide, we will highlight the two monetization options available through Swap API - collecting affiliate fees and trade surplus. We will also discuss pricing considerations and show code samples and a demo app for how to easily implement these options.

How to monetize trades

Swap API offers two monetization options out-of-the-box:

  • Collect affiliate fees (i.e. trading fee or commission)
  • Collect trade surplus (i.e. positive slippage)

Option 1: Affiliate fees

Swap API integrators have the ability to collect an affiliate fee on all trades made through their app.

Pro tip: We recommend setting the fee in a way that strengthens your bottom line while aligning it with the value you provide to customers. Note that the addition of an affiliate fee will impact the price for the end user, so try finding a fee structure where pricing remains competitive while still generating revenue.

Setting up an affiliate fee is easy. Just include the following two parameters when making a Swap API request:

  • feeRecipient - The ETH address that should receive affiliate fees
  • buyTokenPercentageFee - The percentage of the buyAmount (tokens received by the user) that should be attributed to feeRecipient (your wallet) as affiliate fees. Denoted as a decimal between 0 - 1.0 where 1.0 represents 100%.

When the transaction has gone through, the fee amount will be sent to the feeRecipient address you've set. The fee is received in the buyToken (the token that the user will receive).

Option 2: Trade surplus

Slippage is the difference between the expected price of a given trade and the actual price at which it is executed. Trade surplus, also known as positive slippage, occurs when the user ends up receiving more tokens than their quoted amount. Based on our in-depth report on slippage, 18% of trades on Swap API resulted in positive slippage.

Swap API can be easily configured so that you collect the trade surplus. Trade surplus can be collected on all pairs on all supported chains.

It is an opt-in feature. In order to collect trade surplus, all you need to do is set the feeRecipientTradeSurplus parameter in your Swap API requests.

feeRecipientTradeSurplus represents the wallet address you want to collect the fee in. When a transaction produces trade surplus, 100% of it will be sent to the set address. The fee is received in the buyToken (the token that the user will receive).

When feeRecipientTradeSurplus is not specified, the feature is effectively OFF and all trade surplus will be passed back to the user.

Note that trade surplus is only sent to feeRecipientTradeSurplus for sells (i.e. when the sellAmount is specified). It is a no-op for buys (i.e. when the buyAmount is specified), which means the user will always receive the trade surplus.

Demo

Want to see these monetization practices implemented in a live demo? Checkout this demo app to see how to implement collecting affiliate fees in practice:

Conclusion

With Swap API, you can easily power trading in your app. Access thousands of tokens on the most popular blockchains and monetize your users’ trading activity, all with one simple integration. 

Check out the full tutorial on how to monetize your app here.

New to 0x? Sign-up for an account on the 0x Dashboard to integrate and monetize swaps in your app today.

Contents

Subscribe to newsletter

By submitting you're confirming that you agree with our Terms and Conditions.
Yay! You’re signed up.
Oops! Something went wrong, but it's not your fault.

Up next

Fundamentals: Smart Contract Wallets

Oct 15, 2024

Compliance made easy with 0x Address Screening

Sep 26, 2024

0x's next-gen pricing engine is now live

Sep 25, 2024

Introducing state-of-the-art Buy/Sell Tax support

Sep 4, 2024

Take control of your balance sheet with 0x v2

Aug 15, 2024

0x v2 bug bounty program

Jul 30, 2024

What does the "best price" in DeFi really mean?

Jul 23, 2024

Eliminate allowance risk with Permit2

Jul 17, 2024

Introducing 0x's next-gen pricing engine

Jul 15, 2024

0x Dev Digest: May 2024

May 31, 2024

Frame spotlight: Paycaster

May 21, 2024

Frame spotlight: Airstack

May 9, 2024

Power up your Farcaster Frames with 0x swaps

May 2, 2024

0x Dev Digest: April 2024

Apr 30, 2024

Introducing 0x Trade Analytics

Mar 12, 2024

Coinbase Case Study

Jan 30, 2024

Introducing gasless swaps and approvals with Gasless API

Jan 22, 2024

Bitcoin ETFs have arrived

Jan 12, 2024

Building in the open: 0x pricing update

Dec 11, 2023

Matcha leverages Gasless API to bring users the most frictionless trading experience in DeFi

Nov 30, 2023

0x Dev Digest: October 2023

Nov 2, 2023

0x Dev Digest: September 2023

Oct 3, 2023

A comprehensive analysis of RFQ performance

Sep 26, 2023

Unlock optimal trades in Swap API with 0x RFQ liquidity

Sep 20, 2023

0x Dev Digest: August 2023

Aug 31, 2023

Portal launches swaps in its white label MPC wallet powered by 0x

Aug 16, 2023

0x Swap API is now live on Base

Aug 9, 2023

Introducing paid plans for Swap API

Jul 24, 2023

Decreasing Frictions in DeFi hackathon recap

Jul 12, 2023

0x's pricing principles

Jul 3, 2023

0x Dev Digest: June 2023

Jun 30, 2023

App spotlight: tastycrypto

Jun 27, 2023

App spotlight: 31Third

Jun 22, 2023

0x 101: Intro to gasless API

Jun 13, 2023

Inspiration for building with Swap API

Jun 8, 2023

0x Dev Digest: May 2023

May 31, 2023

Fundamentals: What are gas fees?

May 25, 2023

Decreasing Frictions in DeFi Hackathon

May 12, 2023

Swap API liquidity management

May 18, 2023

0x 101: Getting started with Swap API

May 16, 2023

0x 101: Intro to Swap API

May 9, 2023

0x 101: Intro to 0x Orders

May 4, 2023

0x 101: Intro to 0x Protocol

Apr 27, 2023

A new home for 0x Protocol

Apr 24, 2023

Say hi to the new 0x

Apr 20, 2023

0x Year in Review 2022

Jan 5, 2023

0x Swap API expands to Arbitrum

Sep 22, 2022

Managed liquidity

Apr 23, 2020

0x Smart Order Routing

May 19, 2020

App spotlight: Taho

Mar 8, 2022

Fundamentals: What is a Layer 2 chain?

Apr 19, 2023

Fundamentals: What is the difference between quoted, executed, and adjusted prices?

Apr 19, 2023

Fundamentals: What is price impact?

Apr 19, 2023

Fundamentals: What is slippage?

Apr 19, 2023

Fundamentals: What is an automated market maker (AMM)?

Apr 19, 2023

Fundamentals: What is market making?

Apr 19, 2023

Fundamentals: What is a DEX aggregator?

Apr 19, 2023

Fundamentals: What is liquidity?

Apr 19, 2023

Fundamentals: What is a decentralized exchange (DEX)?

Apr 19, 2023

0x at ETHDenver 2023

Mar 21, 2023

The 0x Mission and Values

Jun 7, 2018

Announcing support for new testnets

Aug 10, 2022

0x Swap API expands to Binance Smart Chain

Mar 17, 2021

Scaling DeFi — Layer One

Sep 1, 2021

Introducing Slippage Protection

Jul 14, 2022

San Francisco Blockchain Week 2022 Recap

Nov 21, 2022

0x Swap API adds new liquidity sources

Jul 11, 2022

Review of slippage performance

Sep 14, 2022

Phuture case study

Oct 20, 2022

Measuring the impact of hidden DEX costs

Apr 14, 2022

Market making in DeFi

Aug 12, 2021

Introducing 0x Labs

Jun 22, 2020

Introducing 0x Explorer

Oct 26, 2022

Growing DeFi with professional market makers

Aug 26, 2020

0x 101: How to Access 0x Data

Apr 25, 2023

GameStop chooses 0x Swap API

Jul 8, 2022

Build on Base with 0x

Feb 23, 2023

A comprehensive analysis on DEX liquidity aggregators’ performance

Oct 1, 2020

Announcing 0x Swap API v1

Oct 1, 2020

Access all DEX liquidity through 0x Swap API

Jan 28, 2020

Announcing the 0xpo Summit 2022

Aug 24, 2022

0x Protocol, a preview of what’s to come

Mar 16, 2023

Update to our Privacy Policy

Mar 14, 2023

Price Impact Protection has arrived

Dec 14, 2022

0x Limit Orders Go Multi-Chain

Dec 23, 2021

0x Labs raises $70M Series B led by Greylock to continue expanding Web3’s core exchange infrastructure

Apr 26, 2022

0x launches Tx Relay API in beta, with Robinhood Wallet as first partner

Mar 1, 2023

0x Labs raises $15M Series A to bring decentralized exchange markets to a global audience

Feb 5, 2021

App spotlight: Zerion

Jun 22, 2022

App spotlight: Matcha

Nov 24, 2021

App spotlight: DexGuru

Jun 17, 2021

App spotlight: DEXTools

Sep 23, 2021

App spotlight: DODO

Aug 10, 2021

App spotlight: DappRadar

Dec 16, 2021

App spotlight: DeFi Saver

Jul 20, 2021

0x + Brave partner to make crypto and DeFi more accessible to everyone

Jul 7, 2021

0x Swap API now supports 0x Protocol v4

Mar 1, 2021

0x Swap API is now available on Fantom

Oct 26, 2021

0x Swap API is now live on Optimism

Jan 11, 2022

0x Swap API is now available on Polygon

May 31, 2021