Stablecoin On/Off-Ramp

Convert between fiat (NGN) and stablecoins (USDC or USDT).

Open the interactive version or read this guide as markdown.

Tags: Swap, Balance, Payouts

Paste this prompt into Claude, ChatGPT, or any AI tool. It works best with the CoinCircuit MCP server connected: https://mcp.coincircuit.io


You are helping me build a stablecoin on-ramp and off-ramp into my existing application using CoinCircuit swaps. I have the CoinCircuit MCP server connected.

If you have access to the CoinCircuit MCP server, call these tools for the most accurate and detailed schema outputs:

Use the live MCP data as your source of truth. The details below are a guide, but if the MCP returns something different, trust the MCP.

API Basics

Project Context

I want users to move between fiat and stablecoins held in my CoinCircuit merchant balance:

Swaps convert between two currencies in your CoinCircuit balance at a rate you lock in advance. Supported balance currencies for swaps are NGN and a stablecoin (USDC or USDT). The flow is always: get a quote -> lock a quotation -> execute before it expires.

What I Need You to Implement

1. Check the balance

Endpoint: GET /api/v1/balance?currency={currency} (Call get_endpoint with method get, path /api/v1/balance in the CoinCircuit MCP for the full response schema.)

Confirm availableBalance covers the amount you intend to swap before requesting a quotation.

2. Get an indicative estimate (optional)

Show the user roughly what they'll get before committing. This rate is indicative only, not locked.

Endpoint: GET /api/v1/swap/estimate?fromCurrency={from}&toCurrency={to}&amount={amount} (Call get_endpoint with method get, path /api/v1/swap/estimate in the CoinCircuit MCP for the full response schema.)

Query params:

Response (200): fromCurrency, toCurrency, sourceAmount, targetAmount, rate.

Example: on-ramp 100,000 NGN into a stablecoin, or off-ramp 100.00 USDC/USDT into NGN.

3. Create a locked quotation

When the user commits, lock the rate.

Endpoint: POST /api/v1/swap/quotation (Call get_endpoint with method post, path /api/v1/swap/quotation, section request in the CoinCircuit MCP for the exact request body.)

Request body:

{
  "fromCurrency": "USDC",
  "toCurrency": "NGN",
  "amount": "100.00"
}

Response (201): Returns the quotation:

(Call get_endpoint with method post, path /api/v1/swap/quotation, section success in the CoinCircuit MCP for the full response schema.)

4. Execute the swap

Endpoint: POST /api/v1/swap/execute/{quotationId} (Call get_endpoint with method post, path /api/v1/swap/execute/{quotationId} in the CoinCircuit MCP for the full schema.)

No request body. Pass the quotationId from step 3 in the path. CoinCircuit atomically debits the source currency and credits the target currency at the locked rate.

Response (200): Returns the completed swap:

Errors: 400 (quotation expired, already used, or insufficient balance), 404 (quotation not found).

5. Withdraw fiat to a bank account (complete the off-ramp)

After swapping a stablecoin into NGN, move the NGN out to a bank account.

Endpoint: POST /api/v1/payouts with method: "fiat" (Call get_endpoint with method post, path /api/v1/payouts in the CoinCircuit MCP for the request body and the bank-account recipient setup.)

Fiat payouts settle to the merchant's own registered bank account. Track them with payout.success / payout.failed webhooks.

6. Review swap history

(Call get_endpoint with method get, path /api/v1/swaps in the CoinCircuit MCP for pagination params and the response schema.)

Ramp Flow Summary

On-ramp:  Bank transfer -> NGN balance -> POST /swap/quotation (NGN -> USDC/USDT) -> POST /swap/execute -> stablecoin balance
Off-ramp: Stablecoin balance -> POST /swap/quotation (USDC/USDT -> NGN) -> POST /swap/execute -> NGN balance -> POST /payouts (fiat) -> bank

Constraints