Stablecoin to Stablecoin
Overview
Section titled “Overview”This guide walks you through how to initiate a stablecoin-to-stablecoin wire using FSCO. These transfers are typically used to bridge assets between stablecoin types (e.g. PHPX → USDC) or chains.
This flow typically completes in seconds to minutes depending on network conditions and liquidity.
Prerequisites
Section titled “Prerequisites”- You must have a verified FSCO wallet (
walletId
) with sufficient balance of the source stablecoin. - Your API key must include
wire:write
andwallet:read
permissions. - Destination wallet must support the selected stablecoin and chain.
1. Create a Wire
Section titled “1. Create a Wire”curl -X POST https://api.fsco.io/v2/wires \ -H "Authorization: Bearer $FSCO_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "sourceType": "stablecoin", "sourceCurrency": "USDC", "sourceAmount": "1000", "sourceDetails": { "walletId": "123e4567-e89b-12d3-a456-426614174000" }, "destinationType": "stablecoin", "destinationCurrency": "PHPX", "destinationDetails": { "walletId": "321e4567-e89b-12d3-a456-426614174999" } }'
import axios from 'axios';
const FSCO_API_KEY = process.env.FSCO_API_KEY;const FSCO_API_SECRET = process.env.FSCO_API_SECRET;
const createWire = async () => { const response = await axios.post( 'https://api.fsco.io/v2/wires', { sourceType: 'stablecoin', sourceCurrency: 'USDC', sourceAmount: '1000', sourceDetails: { walletId: '123e4567-e89b-12d3-a456-426614174000' }, destinationType: 'stablecoin', destinationCurrency: 'PHPX', destinationDetails: { walletId: '321e4567-e89b-12d3-a456-426614174999' } }, { headers: { 'x-api-key': FSCO_API_KEY, 'x-api-secret': FSCO_API_SECRET, 'Content-Type': 'application/json', }, } );
console.log('Wire created:', response.data);};
createWire();
import requestsimport os
FSCO_API_KEY = os.getenv("FSCO_API_KEY")
headers = { "Authorization": f"Bearer {FSCO_API_KEY}", "Content-Type": "application/json",}
payload = { "sourceType": "stablecoin", "sourceCurrency": "USDC", "sourceAmount": "1000", "sourceDetails": {"walletId": "123e4567-e89b-12d3-a456-426614174000"}, "destinationType": "stablecoin", "destinationCurrency": "PHPX", "destinationDetails": {"walletId": "321e4567-e89b-12d3-a456-426614174999"},}
response = requests.post("https://api.fsco.io/v2/wires", json=payload, headers=headers)
print("Wire created:", response.json())
using System;using System.Net.Http;using System.Net.Http.Headers;using System.Text;using System.Threading.Tasks;
class WireCreator{ static async Task Main() { var apiKey = Environment.GetEnvironmentVariable("FSCO_API_KEY");
var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", apiKey);
var json = @"{ ""sourceType"": ""stablecoin"", ""sourceCurrency"": ""USDC"", ""sourceAmount"": ""1000"", ""sourceDetails"": { ""walletId"": ""123e4567-e89b-12d3-a456-426614174000"" }, ""destinationType"": ""stablecoin"", ""destinationCurrency"": ""PHPX"", ""destinationDetails"": { ""walletId"": ""321e4567-e89b-12d3-a456-426614174999"" } }"; var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://api.fsco.io/v2/wires", content); var responseString = await response.Content.ReadAsStringAsync();
Console.WriteLine("Wire created: " + responseString); }}
Response:
{ "id": "9ba1f880-d23e-4c98-b688-60d63fb1cf30", "status": "pending", "type": "transfer", "sourceType": "stablecoin", "sourceCurrency": "USDC", "sourceAmount": "1000", "sourceDetails": { "walletId": "123e4567-e89b-12d3-a456-426614174000" }, "destinationType": "stablecoin", "destinationCurrency": "PHPX", "destinationAmount": null, "destinationDetails": { "walletId": "321e4567-e89b-12d3-a456-426614174999" }, "createdAt": "2025-05-05T12:34:56.000Z", "updatedAt": null, "completedAt": null, "txHashes": [], "externalReferences": {}, "reference": null, "notes": null}
This creates the wire. The user must now approve a stablecoin transfer from their wallet to FSCO.
Once the stablecoins are received, FSCO will perform the conversion and send the destination stablecoin to the target wallet.
2. Wait for Transfer and Processing
Section titled “2. Wait for Transfer and Processing”After the user approves the stablecoin transfer:
- FSCO receives the stablecoins into its smart contract or custody wallet.
- FSCO matches the transfer to the wire.
- The source stablecoin is converted to the destination stablecoin.
- FSCO transfers the destination stablecoin to the provided
walletId
oraddress
. - The wire status is updated and a
wire.completed
webhook is emitted (if configured).
To check the wire status at any time:
curl -X GET https://api.fsco.io/v2/wires/<wireId> \ -H "Authorization: Bearer $FSCO_API_KEY"
import axios from 'axios';
const FSCO_API_KEY = process.env.FSCO_API_KEY;const FSCO_API_SECRET = process.env.FSCO_API_SECRET;const wireId = "<wireId>"; // Replace with actual wire ID
const getWire = async () => { const response = await axios.get( `https://api.fsco.io/v2/wires/${wireId}`, { headers: { 'x-api-key': FSCO_API_KEY, 'x-api-secret': FSCO_API_SECRET } } );
console.log('Wire details:', response.data);};
getWire();
import requestsimport os
FSCO_API_KEY = os.getenv("FSCO_API_KEY")FSCO_API_SECRET = os.getenv("FSCO_API_SECRET")wire_id = "<wireId>" # Replace with actual wire ID
headers = { "x-api-key": FSCO_API_KEY, "x-api-secret": FSCO_API_SECRET}
response = requests.get(f"https://api.fsco.io/v2/wires/{wire_id}", headers=headers)
print("Wire details:", response.json())
using System;using System.Net.Http;using System.Net.Http.Headers;using System.Threading.Tasks;
class WireGetter{ static async Task Main() { var apiKey = Environment.GetEnvironmentVariable("FSCO_API_KEY"); var wireId = "<wireId>"; // Replace with actual wire ID
var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", apiKey);
var response = await client.GetAsync($"https://api.fsco.io/v2/wires/{wireId}"); var responseString = await response.Content.ReadAsStringAsync();
Console.WriteLine("Wire details: " + responseString); }}
Response:
{ "id": "9ba1f880-d23e-4c98-b688-60d63fb1cf30", "status": "pending", "type": "transfer", "sourceType": "stablecoin", "sourceCurrency": "USDC", "sourceAmount": "1000", "sourceDetails": { "walletId": "123e4567-e89b-12d3-a456-426614174000" }, "destinationType": "stablecoin", "destinationCurrency": "PHPX", "destinationAmount": null, "destinationDetails": { "walletId": "321e4567-e89b-12d3-a456-426614174999" }, "createdAt": "2025-05-05T12:34:56.000Z", "updatedAt": null, "completedAt": null, "txHashes": [], "externalReferences": {}, "reference": null, "notes": null}
The status
field will reflect the current state (e.g. processing
, completed
, failed
).
3. Receive Stablecoins
Section titled “3. Receive Stablecoins”Once the conversion and transfer are complete:
- The destination wallet receives the stablecoins.
- The wire is marked as
completed
. - A
wire.completed
webhook is triggered with full transaction details.
Important Notes
Section titled “Important Notes”- Use the
wireId
returned from creation to fetch status, generate receipts, or view history. - Wallets must support the target stablecoin and be active on supported chains.
- Use webhooks for real-time updates, or poll the status endpoint if needed.
- Routing is automatically optimized based on liquidity and network availability.