For partners

Add Canton Coin swaps to your app

Float swaps Canton Coin (CC) to and from more than 1,600 assets. A partner adds it in one of two ways. The widget is a pop-up with a referral code and no API key. The API runs on your own server with a key, and gives you your own swap screen. This page explains both, the order states and the webhooks.

1. Choose a route

RouteYou needGood fit when
Widget (pop-up)A referral code from your partner page, and one script tag.You want the buy and sell flow in your app without building one.
API (your own screen)An API key, a server to hold it, and a webhook receiver if you want push updates.You want your own screens, your own copy and your own order tracking.

Sign in on the partner page to create a key or copy your referral code.

2. The widget

Add the script once. Then open the pop-up from any button. Pass your referral code in data-float-ref, or in ref when you call the function.

<script src="https://www.myfloat.cc/widget.js" async></script>
<button data-float-open="deposit" data-float-ref="YOUR_CODE">Get CC</button>

<script>
  Float.open({ mode: "deposit", ref: "YOUR_CODE", theme: "auto" });
</script>

The options are mode (deposit or withdraw), ref, party (the user's Canton party ID, if your app knows it), assets (CC by default, or a list of Canton tokens), theme (auto, light or dark), title, tab, method, and the callbacks onEvent, onClose and onSendRequest. Events never carry a claim token, an address or an amount.

Try it with your own party ID on the widget demo. For a plain link, use https://www.myfloat.cc/widget?mode=deposit&ref=YOUR_CODE. That page is the pop-up itself, built for embedding, and it is not indexed.

3. The API flow

Call the API from your server. Keep the key in an environment variable such as FLOAT_API_KEY. Browser calls from your own domain are blocked by CORS, so have your page call a proxy route on your server.

  1. GET /v1/assets?all=1: the asset list, for a token picker. Cache it.
  2. POST /v1/quote: an indicative price across every partner. There is no quote id and no expiry, so debounce it as the user types. Send "rateType": "float" for a market rate.
  3. POST /v1/order: opens the order from your server, with your key and an Idempotency-Key header (one UUID per intended order). A retry with the same key and body returns the same order.
  4. Show the user depositAddress, the exact amountIn and depositDeadline. Opening an order moves no money.
  5. Follow the order with webhooks, or poll GET /v1/order/{claimToken} every 10 to 30 seconds, until the state is final.
curl -s "https://api.myfloat.cc/v1/quote" \
  -H "Content-Type: application/json" \
  -d '{"direction":"in","from":"USDT","amount":"100","rateType":"float"}'

Amounts are decimal strings. Parse them with a decimal library, never with floating-point numbers. Errors look like { "error": "...", "code": "..." }: show the error text as plain text, and branch on code.

4. Order states

Drive the user interface from state. Treat the progress states as information. Only the four final states are facts.

StateWhat it means and what to show
awaiting_refund_addressGet CC only: the route needs the user's refund address first. Ask for it, then send it to the refund-address endpoint. Nothing is sent yet.
preparing_deposit_addressWithdraw CC only: Float is creating the deposit address. Show a progress message and poll every 5 seconds.
awaiting_depositWaiting for the user's payment. Show the exact amount and a countdown to the deposit deadline.
confirmingThe payment was seen and is being confirmed. Nothing for the user to do.
exchangingThe swap partner is swapping. Show progress.
sendingThe payout is on its way to the user.
completedFinal. The user has been paid.
refundedFinal. The payment went back to the user.
failedFinal. The swap did not complete. Send the user to support with the order link.
expiredFinal. The deposit window closed with nothing received. Nothing was sent and nothing is owed.

5. Webhooks

Register an HTTPS endpoint with POST /v1/webhooks. The signing secret is shown once. Events: order.state_changed, payout.updated and webhook.test.

  • Each request has a Float-Signature: t=<unix>,v1=<hex> header. The value is HMAC-SHA256 over <t>.<raw body>, keyed with your secret. Accept a timestamp within 5 minutes.
  • Retries run with backoff for 24 hours. After 10 failures over 12 hours the endpoint pauses. You can have up to 5 endpoints.
  • De-duplicate on the event id. Read the order again with GET /v1/order/{claimToken} when an event arrives.

6. Limits and fees

  • With an API key: per key, per minute, 60 quotes, 20 orders (and refund-address calls) and 300 other requests.
  • Without a key: per IP, about 100 quotes, orders or other writes a minute and 120 reads a minute. At most 20 unpaid orders per IP. A server that calls without a key shares that budget across all its users, so use a key.
  • Fees: Float's fee is built into every quote and depends on the route. The amount you see is the amount you get.
  • Earnings: Orders filled by the Float Pool earn the share too: an order with an API key or referral code pays the pool a 0.3% fee, and the share comes out of it. The share is 0.2% of the CC side of each order you route.

Questions partners ask

Is there a test environment?

No sandbox. Asset lists and quotes are free to call. Orders are real: harmless until someone pays, but do not open them in automated tests, and do not send a deposit while testing.

Why does the API refuse some amounts?

Each route has a minimum and a maximum. The refusal names the limit in its error text, and that text is the sentence to show the user. Branch on the error code, not on the words.

Do I need an API key for the widget?

No. The widget needs only your referral code, which is public and safe to put in page code. Never ask for an API key in the widget.

Can I add a Canton token such as CBTC?

Yes. GET /v1/canton-assets lists the tokens that can sit on the Canton side of a swap. Send the symbol as cantonAsset on the quote and the order.

Where do partner earnings come from?

Orders filled by the Float Pool earn the share too: an order with an API key or referral code pays the pool a 0.3% fee, and the share comes out of it. The share is 0.2% of the CC side of each order you route.

Reference