Skip to main content
Swap testing works the same as production. Follow these steps to test a crypto-to-crypto swap:

Swap Flow Overview

  1. Get Assets - Fetch available assets via GET /ramp/assets
  2. Create Quote - Generate a swap quote via POST /ramp/quote with type: "swap"
  3. Create Swap - Execute the swap via POST /ramp/swap
  4. Sign Transaction - Receive the sendTransaction in the swap_updated webhook
  5. Submit to Blockchain - Sign and submit the transaction to the testnet
  6. Completion - Receive a swap_updated webhook with status completed

Interactive Tutorial

Use the interactive tutorial below to test the swap flow with your sandbox API key. Each step builds on the previous one, and you can edit the request bodies before sending.

Manual Testing

If you prefer to test manually, here are the individual API calls:

1. Get Available Assets

GET /ramp/assets?blockchain=stellar&currency=mxn&wallet=YOUR_WALLET_ADDRESS

2. Create Swap Quote

POST /ramp/quote
{
  "quoteId": "your-quote-uuid",
  "customerId": "your-customer-uuid",
  "blockchain": "stellar",
  "quoteAssets": {
    "type": "swap",
    "sourceAsset": "USDC:GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN",
    "targetAsset": "CETES:GCRYUGD5NVARGXT56XEZI5CIFCQETYHAPQQTHO203IQZTHDHH4LATMYW"
  },
  "sourceAmount": "10"
}

3. Create Swap

POST /ramp/swap
{
  "swapId": "your-swap-uuid",
  "publicKey": "your-wallet-public-key",
  "quoteId": "quote-id-from-step-2"
}

4. Handle Webhook

You’ll receive a swap_updated webhook with the transaction to sign:
{
  "swap_updated": {
    "orderId": "your-swap-uuid",
    "customerId": "your-customer-uuid",
    "sendTransaction": "AQAAAA...encoded_transaction",
    "status": "created"
  }
}
Sign the sendTransaction and submit it to the Stellar testnet. Once confirmed, you’ll receive another webhook with status: "completed".