Payments
Crypto Payments — Hosted checkout & API for 30+ coins White Label — Your brand on the entire payment flow Processing — Auto-convert, withdrawals & controls Payouts — Mass crypto payouts by API or file Platform — Marketplace payments & commissions
Swap Plugins Affiliate Pricing Blog Docs Contact
Sign in
Public · keyless · rate-limited

Exchange API

Quote and execute instant crypto-to-crypto swaps programmatically. No account, no API key — just call the endpoints below. Every swap is tracked by its tracking_id. Base URL https://cryptopayr.com.

How a swap works

  1. 1
    Estimate the receive amount for a pair + amount (float or fixed rate).
  2. 2
    Create the order with a payout address (and optional refund address). You get a deposit address + tracking_id.
  3. 3
    Send the from coin to the deposit address.
  4. 4
    On confirmation we pay the to coin to your payout address. Poll status to follow along.

Embeddable widget

Put the whole swap flow on your own site with a few lines — no backend, no API key. The widget is an isolated iframe that auto-resizes, matches your theme and accent colour, and can pay your referral wallet 50% of our fee on every swap. Loaded from https://cryptopayr.com/js/exchange-widget.js.

<div id="swap"></div>
<script src="https://cryptopayr.com/js/exchange-widget.js"></script>
<script>
  new Exchange({
    container: "#swap",           // selector or element (required)
    theme: "auto",                // "light" | "dark" | "auto"
    accent: "#08a05a",            // your brand colour
    referralWallet: "0xYourWallet",   // earns 50% of our fee
    referralTo: "USDT",               // referral payout coin
    referralNetwork: "TRON",          // referral payout network
    from: "BTC", to: "ETH", amount: 0.01,   // optional defaults
    rateType: "float",            // "float" | "fixed"
    lockCoins: false,             // lock the coin selection
    onComplete: function (e) { console.log("done", e.tracking); },
    onStatus:   function (e) { console.log("status", e.status); }
  });
</script>

Options

Option Description
containerSelector or element to mount into (required).
themelight, dark or auto.
accentBrand colour, e.g. #08a05a.
referralWallet / referralTo / referralNetworkYour referral wallet + payout coin and network — earns 50% of our fee.
from / to / fromNetwork / toNetworkDefault coins and networks.
amountDefault send amount.
rateTypefloat or fixed.
lockCoinsLock the coin selection to your defaults.
width / height / radiusWidget size and corner radius.

Callbacks

onCreated, onStatus, onComplete, onEvent — each is also dispatched as a cryptopayr-exchange:<event> DOM event on the container.

Declarative mount also works via data-cryptopayr-exchange + matching data-* attributes.

On WordPress? Skip the code — install the CryptoPayr Exchange plugin and drop the widget on any page with a [cryptopayr_exchange] shortcode or Gutenberg block, themed from a settings screen.

Endpoints

GET /api/v1/swap/currencies

List supported coins, networks and the fee/limit metadata.

curl https://cryptopayr.com/api/v1/swap/currencies

GET /api/v1/swap/estimate

Quote a receive amount. Params: from, from_network, to, to_network, amount, type (float|fixed).

curl "https://cryptopayr.com/api/v1/swap/estimate?from=BTC&from_network=BTC&to=ETH&to_network=ETH&amount=0.01&type=fixed"

POST /api/v1/swap/create

Create a swap. JSON body: from, from_network, to, to_network, amount, type, payout_address, refund_address?. Optional referral: referral_wallet_address, referral_wallet_to, referral_wallet_network — that wallet earns 50% of our service fee. Returns the deposit address + tracking id.

curl -X POST https://cryptopayr.com/api/v1/swap/create \
  -H 'Content-Type: application/json' \
  -d '{
    "from":"BTC","from_network":"BTC",
    "to":"ETH","to_network":"ETH",
    "amount":0.01,"type":"float",
    "payout_address":"0xYourEthAddress",
    "refund_address":"bc1YourBtcRefund",
    "referral_wallet_address":"0xYourReferralWallet",
    "referral_wallet_to":"USDT",
    "referral_wallet_network":"TRON"
  }'

GET /api/v1/swap/status

Follow a swap. Param: id = the tracking id.

curl "https://cryptopayr.com/api/v1/swap/status?id=SWP-XXXX-YYYY"

POST /api/v1/swap/receipt

Email a receipt. JSON body: id, email. Only available 30 minutes after the swap ends.

curl -X POST https://cryptopayr.com/api/v1/swap/receipt \
  -H 'Content-Type: application/json' \
  -d '{"id":"SWP-XXXX-YYYY","email":"[email protected]"}'

Status values

AWAITING_DEPOSITCONFIRMINGEXCHANGINGSENDINGCOMPLETED. Error paths: REFUND_PENDINGREFUNDED, or EXPIRED / FAILED.

Referrals

Pass a referral_wallet_address (+ referral_wallet_to coin and referral_wallet_network) on create and that wallet earns 50% of our service fee on the swap, based on the amount actually received. Earnings accrue per wallet and are paid out automatically once the balance clears the minimum; small amounts roll over to the next swap.

Notes