Skip to content

Add Solana Swap API monetization guide - #262

Merged
jlin27 merged 10 commits into
mainfrom
solana-monetization-guide
Jul 27, 2026
Merged

Add Solana Swap API monetization guide#262
jlin27 merged 10 commits into
mainfrom
solana-monetization-guide

Conversation

@jlin27

@jlin27 jlin27 commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a new Monetize Your App on Solana guide documenting the monetization controls now available on the Solana Swap API (volume-based affiliate fees), and cleans up related navigation and stale API-reference links.

Note on trade surplus

Per GTM decision, trade surplus will not be publicly presented as a monetization option for Solana.

Changes

  • New guide: solana-swap-api/guides/monetize-your-app.mdx, mirroring the structure of the EVM monetize guide but adapted to Solana's POST/JSON, snake_case, ppm-based API:
    • Affiliate feesswap_fee_ppm, swap_fee_recipient, swap_fee_side; single- and multi-fee/multi-recipient examples; buy vs sell side behavior; ppm-vs-bps note; sequential fee compounding; fee recipient account requirements; per-app fee cap (default 100,000 ppm / 10%, enforced per entry).
  • Nav: registered the guide in the Solana Swap API section (after Get Started).
  • Title disambiguation: the two monetization guides are now "Monetize Your App on Solana" and "Monetize Your App on EVM".
  • Stale link fix: the Solana Swap Instructions API-reference path …/solana-swap/solana-swap-swap-instructions 404s in production; updated links to …/swap/instructions (with #request.body.* anchors) in important-integration-notes.mdx, faq.mdx, and api-reference-overview.mdx.

Testing

  • fern check passes.
  • Previewed locally with fern docs dev

jlin27 added 2 commits July 22, 2026 16:06
Add a new "Monetize Your App on Solana" guide covering the two
monetization mechanisms now available on the Solana Swap API:

- Affiliate fees (swap_fee_ppm / swap_fee_recipient / swap_fee_side),
  including multi-fee/multi-recipient requests, buy vs sell side,
  ppm-vs-bps, sequential fee compounding, fee recipient account
  requirements, and the per-app fee cap.
- Trade surplus capture (trade_surplus_cap_ppm / trade_surplus_recipient).

Also:
- Register the guide in the Solana Swap API nav.
- Disambiguate both monetization guide titles: "Monetize Your App on
  Solana" and "Monetize Your App on EVM".
- Fix stale Solana Swap Instructions API-reference links (the
  .../solana-swap/solana-swap-swap-instructions path 404s) in
  important-integration-notes, faq, and api-reference-overview.
@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown

@jlin27
jlin27 requested a review from D-J-Harris July 22, 2026 23:31

@D-J-Harris D-J-Harris left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this section intentionally leaving out trade surplus for now? I see it also isn't in the planned release in socials

Comment on lines +34 to +36
<Note>
Fees on Solana are expressed in **parts per million (ppm)**, not basis points. `1_000_000` ppm = 100%, so a 1% fee is `10000` ppm and a 5% fee is `50000` ppm.
</Note>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think include underscores here too for number formatting (and elsewhere it isn't already applied)


### Buy-side vs sell-side fees

- **`buy`** — the fee is taken from the output token. This reduces the `amount_out` and `min_amount_out` returned in the quote.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't have a min_amount_out field, can be removed (here and elsewhere in the doc)

In this example, a 5% and a 2.5% fee are collected on the buy token for two different recipients, and a 1% fee is collected on the sell token for a third.

<Note>
Fees on the **same side** are applied **sequentially**: each entry is charged on the amount remaining after the previous entries on that side have been deducted, not on the original amount. For example, two buy-side fees of `50000` and `25000` ppm produce an effective fee of ~7.38%, not 7.5%. Each fee amount is rounded up to the next base unit when needed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might as well put 7.375%, it's the same number of chars


When deciding how much to charge, set your pricing in a way that strengthens your bottom line while aligning with the value you provide to customers. The volume-based fee impacts the price for the end user, so find the sweet spot where your solution remains competitive.

Be aware that `swap_fee_ppm` has a default per-app limit of `100_000` ppm (10%) for security. The cap is enforced **per fee entry, not on the combined total**: each fee in the list is validated individually against the limit. For example, two sell-side fees of `60000` ppm (6%) each are both accepted under a `100_000` ppm cap, even though they sum to 12%, because neither individual entry exceeds the cap. If your application requires a higher per-entry value, [please reach out to us](https://docs.0x.org/docs/introduction/need-help#-contact-developer-support-fastest-direct-help).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it "for security"? If so, can keep. I feel we can probably remove these two qualifier words though

Comment on lines +38 to +59
### Example API call

The following request takes a single 1% fee on the buy (output) token and sends it to your fee account:

```js
const response = await fetch("https://api.0x.org/solana/swap-instructions", {
method: "POST",
headers: {
"0x-api-key": process.env.ZEROEX_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({
token_out: "So11111111111111111111111111111111111111112", // Buy SOL
token_in: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", // Sell USDC
amount_in: 100000000, // 100 USDC (6 decimals)
taker: takerKeypair.publicKey.toBase58(),
swap_fee_ppm: "10000", // 1% fee (10,000 ppm)
swap_fee_recipient: "3emsAVdmGKERbHjmGfQ6oZ1e35dkf5iYcS6U4CPKFVaa", // Your fee account
swap_fee_side: "buy", // Collect the fee on the output token
}),
});
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

genuine q - is this code snippet required? I feel with the fields described above, and the extension case provided below, this doesn't add much

Comment on lines +12 to +16
See below for pricing guidance and code examples.

## Monetization

Out-of-the-box, the 0x Solana Swap API lets you collect one or more volume-based fees (aka affiliate fees, trading fees, or commission) directly within a swap request, available on all pricing plans.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this line and section doesn't add much, especially for a ## header. can collapse pricing plans bit into intro, embellish intro to volume-based fees with anything needed from here etc.

To apply volume-based fees, include the following fields in the body of your [`/solana/swap-instructions` request](/api-reference/solana-swap-ap-is/swap/instructions):

- [`swap_fee_ppm`](/api-reference/solana-swap-ap-is/swap/instructions#request.body.swap_fee_ppm) — the fee amount(s) in **parts per million (ppm)**. Each entry must be between `0` and your per-app maximum (`100_000` ppm / 10% by default — see [Pricing considerations](#pricing-considerations)), and a value of `0` disables that entry. Supports single or multiple comma-separated values.
- [`swap_fee_recipient`](/api-reference/solana-swap-ap-is/swap/instructions#request.body.swap_fee_recipient) — the account(s) to receive the fees. Supports single or multiple comma-separated values, and must contain the same number of entries as `swap_fee_ppm`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

each of the three bullet points is quite verbose, or not "qualitative and to the point". e.g. each using word count to mention "Supports single or multiple comma-separated values" feels like it could be removed, especially considering this is clear in the API reference, and also referred to below

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TLDR focus on each bullet being snappy and not a reflection of the (more technical, where details matter) API reference

@jlin27

jlin27 commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

Is this section intentionally leaving out trade surplus for now? I see it also isn't in the planned release in socials

re: TS - I was asked by GTM to remove the TS sections. The reason being they don’t want to publicize it in order to use it as a lever in negotiations.

Comment on lines +10 to +23
See our [Monetization Report](https://0x.org/reports/monetization-across-defi-report) to learn how top DeFi apps are turning trading activity into millions.

See below for pricing guidance and code examples.

## Monetization

<Tip>
⚡️ [Example code](https://github.com/0xProject/0x-examples/tree/main/solana-example) for integrating the Solana Swap API.

⚡️ See the [Solana Swap API reference](/api-reference/solana-swap-ap-is/swap/instructions) for the full request and response schema.

</Tip>

## Collect volume-based fees

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this bit still looks weird to me (I understand I caused it) - what is this section, what is the need for the tip, can it live elsewhere etc.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's an artifact from the EVM template. let me remove


To apply volume-based fees, include the following fields in the body of your [`/solana/swap-instructions` request](/api-reference/solana-swap-ap-is/swap/instructions):

- [`swap_fee_ppm`](/api-reference/solana-swap-ap-is/swap/instructions#request.body.swap_fee_ppm) — the fee amount(s) in **parts per million (ppm)**. Each entry must be between `0` and your per-app maximum (`100_000` ppm / 10% by default).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Each entry must be between 0 and your per-app maximum (100_000 ppm / 10% by default)" this bit still feels like an implementation detail best left to the api reference

Fees on the **same side** are applied **sequentially**: each entry is charged
on the amount remaining after the previous entries on that side have been
deducted, not on the original amount. For example, two buy-side fees of
`50_000` and `25_000` ppm produce an effective fee of ~7.375%, not 7.5%. Each

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can remove the tilda - it's exact


The fee you charge is fully determined by the values you send in the request, so you can display it in your UI directly from those: each `swap_fee_ppm` rate, the token it is charged in (the output token for a `buy` fee, the input token for a `sell` fee), and its `swap_fee_recipient`.

The quote already reflects any buy-side fees: the returned `amount_out` are net of them, so the value you show the user as the amount received is correct as-is. Sell-side fees reduce the amount routed into the swap before the quote is produced.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"is net of them"


### Fee recipient accounts

<Warning>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should the warning go at the bottom of this section rather than leading it?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would in fact argue this warning section is not needed - the text links to a page which explains the same exact thing

@jlin27
jlin27 merged commit a83f7a2 into main Jul 27, 2026
3 checks passed
@jlin27
jlin27 deleted the solana-monetization-guide branch July 27, 2026 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants