Skip to main content
This guide is for a launchpad or a token platform. The whole integration is three things:
  1. Search for a recipient while a creator types.
  2. Create a config for the recipients the creator picked.
  3. Show the recipients of a coin on its page.
Every call is made from your backend, with your API key, on https://api.donate.gg/api/v2.

Before you start

  • An API key, kept on your server. See API keys.
  • A registered donation source. This is the on-chain address your fee program’s donations are credited to. Donate registers it to your project so that it can tell which coin and which creator each donation is for. Email support@donate.gg to register one.
  • The costs. A donation through a config your project created pays a 20% fee today, a config is permanent, and there is no sandbox. See Before you build.

The calls you make

Send your key on every call, including the ones where it is optional. A keyed call counts against your organization’s rate limit instead of the 20 a minute an IP address gets.

Build it

1

Search while the creator types

The picker starts empty. When the creator has typed something, send it as term. The answer lists the charities and campaigns that can be named in a new config, best match first.
An example answer:
Show imageUrl, name and a badge for type on each row. Keep type and id of every row the creator picks: the two together are the recipient. Build a beneficiary picker covers the filters, the fallbacks and what to do when a charity is not listed.
2

Create the config

When the creator confirms, create a config on your server. A config is a permanent split: the recipients and the weight of each. Several recipients are normal. This one gives a charity three quarters and a campaign one quarter.
An example answer. The id illustrates the shape:
  • The body names recipients and nothing else. There is no name, logo or fee to send, and no wallet address for a charity or a campaign. The config id carries the route.
  • Weights are relative, not percentages. List one to five beneficiaries. See configs and weights.
  • The status says what happened. 201 means this request created the config. 200 means your project already had a config with these beneficiaries and weights, and the body is that config. Two coins with the same beneficiaries and the same weights share one config. Weights are compared as written: 3 and 1 give a different config from 75 and 25, and both are permanent.
  • A retry is safe. After a timeout, send the same body again. You get the config the first attempt created.
  • A config is never edited. On the rare occasion a creator changes where a live coin’s rewards go, create a whole new config and point the coin at it.
Store id and idBase58 with the coin. Both are the same 32 bytes.If the request is refused, branch on code:Both 422s say which recipients they are about: issues has one entry for each, and its path is the recipient’s place in the body, such as beneficiaries[1]. Ask the creator to replace those.
issues is absent when the refusal cannot be tied to one recipient. Then send every reference of the body to GET /v2/beneficiaries/lookup?ids= and look for available: false, or read each recipient in full and look for eligible: false.Errors has the body and every other code.
3

Show the fee

A config has no fee on it. The fee a donation pays is set by Donate’s fee policy when the donation settles, and this call quotes it. chainId is the chain the donation is made on (101 is Solana). creditedAddress is the address the donation is credited to on-chain, which for your coins is your registered donation source. Here $DONATION_SOURCE holds that address.
An example answer:
feeBps is in basis points: 2000 is 20% of each donation. It is an estimate, not a locked rate. Fees explains the quote.
4

Attach the config to the coin on-chain

Your fee program keeps the config id for each coin and donates to it through the Donation Relay program.
  • On Solana, use idBase58 as a Pubkey with donate_pubkey_config_id_v1, or decode id to 32 bytes for donate_v1. Accounts and arguments are on the Solana page. On an EVM chain, id is the bytes32 the contract takes.
  • Set credited_to to your registered donation source address.
  • Set message to the coin’s mint and the creator’s wallet, separated by a comma: <mint>,<creator>. Both must be valid addresses. The message can be at most 255 bytes.
Donate reads those two values to count the donation for that coin and that creator. A donation from your source with any other message is still paid to the config, and it is not counted for a coin.
5

Show who the coin supports

Use the coin’s config id to get each recipient’s name, logo, website, socials and weight. A campaign includes the charities it supports. It stays on the coin page when it completes. Keep sending fees to the same config. If a Tiltify campaign closes, Donate works with Tiltify to credit the fees that arrive afterward.
Start from the config you stored, not from the coin read: GET /v2/coins/{chainId}/{address} finds the config a coin pays for the coins of one launchpad only. See Coins and donation sources.Show what a coin donates to has the whole page: the rows, the details view that opens when a row is clicked, and what to cache.

Totals

You know what each of your coins has donated, so show your own numbers. Donate’s totals are there when you want them: stats on GET /v2/coins/{chainId}/{address} is everything a coin has donated, and GET /v2/donation-sources/{chainId}/{address}/coins ranks the coins of your own donation source. Leaderboards and stats covers them.

What to cache

  • A config. It never changes. Keep id, idBase58 and beneficiaries for as long as you like.
  • A search answer and a recipient’s name and image. These change rarely. Keeping them for hours is fine. A recipient can become unavailable later, so do not keep them forever.
  • The fee quote. It can change with the fee policy. Ask again when you show it.

What to tell creators

  • A config is permanent. Choosing other recipients later means a new config for the coin.
  • A coin’s donated total moves when its fees are claimed and donated, which happens in batches. It does not move with every trade.
  • A donation is not final the moment it is sent. See Track a donation.
  • If a charity later opts out or is removed, the coin keeps paying its config and the charity is shown as a stand-in.

Runnable sequence