Developer Documentation

CloaxPay Swap Integration

Add cryptocurrency swap functionality to your platform in minutes

Embeddable Widget

1. Install Dependencies

npm install @cloaxpay/swap-widget
# or
yarn add @cloaxpay/swap-widget

2. Import & Use

import { SwapWidget } from '@cloaxpay/swap-widget'

function MyPage() {
  return (
    <SwapWidget
      theme="dark"
      primaryColor="#3B82F6"
      onSuccess={(swapId) => {
        console.log('Swap completed:', swapId)
        // Handle success
      }}
      onError={(error) => {
        console.error('Swap failed:', error)
        // Handle error
      }}
    />
  )
}

3. Props & Configuration

theme - 'light' | 'dark' (default: 'dark')

primaryColor - Hex color (default: '#3B82F6')

allowedCoins - string[] - Restrict available coins (optional)

defaultFromCoin - Pre-select from coin (optional)

defaultToCoin - Pre-select to coin (optional)

onSuccess - (swapId: string) => void

onError - (error: string) => void

Iframe Embed (No Code)

<iframe 
  src="https://cloaxpay.com/swap"
  width="500"
  height="700"
  style="border: none; border-radius: 12px;"
></iframe>