Stablecoin to Fiat
Overview
Section titled “Overview”This guide walks you through how to initiate a stablecoin-to-fiat wire using FSCO. These transfers are typically used to off-ramp users from blockchain-based stablecoins into traditional bank accounts.
This flow typically completes in minutes to hours depending on network confirmation and fiat payout speed.
Prerequisites
Section titled “Prerequisites”- You must have a verified FSCO wallet (walletId) with sufficient stablecoin balance.
- Your organisation must be KYC/AML-approved with supported off-ramp providers.
- You must have a connected account set up to receive fiat.
- Your API key must include wire:write and wallet:read permissions.
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": "PHPX", "sourceAmount": "10000", "sourceDetails": { "walletId": "123e4567-e89b-12d3-a456-426614174000" }, "destinationType": "fiat", "destinationCurrency": "PHP", "destinationDetails": { "connectedAccountId": "acc_abc123" } }'
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: 'PHPX', sourceAmount: '10000', sourceDetails: { walletId: '123e4567-e89b-12d3-a456-426614174000' }, destinationType: 'fiat', destinationCurrency: 'PHP', destinationDetails: { connectedAccountId: 'acc_abc123' } }, { 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": "PHPX", "sourceAmount": "10000", "sourceDetails": {"walletId": "123e4567-e89b-12d3-a456-426614174000"}, "destinationType": "fiat", "destinationCurrency": "PHP", "destinationDetails": {"connectedAccountId": "acc_abc123"},}
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"": ""PHPX"", ""sourceAmount"": ""10000"", ""sourceDetails"": { ""walletId"": ""123e4567-e89b-12d3-a456-426614174000"" }, ""destinationType"": ""fiat"", ""destinationCurrency"": ""PHP"", ""destinationDetails"": { ""connectedAccountId"": ""acc_abc123"" } }"; 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": "e5d12f10-9c3a-4b2b-a987-55ff9d982b3a", "status": "pending", "type": "off-ramp", "sourceType": "stablecoin", "sourceCurrency": "PHPX", "sourceAmount": "10000", "sourceDetails": { "walletId": "123e4567-e89b-12d3-a456-426614174000" }, "destinationType": "fiat", "destinationCurrency": "PHP", "destinationAmount": null, "destinationDetails": { "connectedAccountId": "acc_abc123" }, "createdAt": "2025-05-05T12:34:56.000Z", "updatedAt": null, "completedAt": null, "txHashes": [], "externalReferences": { "transferRequestId": "REQ-987654321" }, "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 initiate the fiat payout.
2. Wait for Transfer and Provider Notification
Section titled “2. Wait for Transfer and Provider Notification”After the user authorises the stablecoin transfer:
- FSCO receives the stablecoins into its smart contract or custody wallet.
- FSCO matches the transfer to the correct wire.
- The stablecoins are converted to the destination fiat currency.
- FSCO initiates the fiat transfer to the connected account.
- 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": "e5d12f10-9c3a-4b2b-a987-55ff9d982b3a", "status": "pending", "type": "off-ramp", "sourceType": "stablecoin", "sourceCurrency": "PHPX", "sourceAmount": "10000", "sourceDetails": { "walletId": "123e4567-e89b-12d3-a456-426614174000" }, "destinationType": "fiat", "destinationCurrency": "PHP", "destinationAmount": null, "destinationDetails": { "connectedAccountId": "acc_abc123" }, "createdAt": "2025-05-05T12:34:56.000Z", "updatedAt": null, "completedAt": null, "txHashes": [], "externalReferences": { "transferRequestId": "REQ-987654321" }, "reference": null, "notes": null}
The status
will reflect the current state (e.g. processing
, completed
, failed
).
3. Receive Fiat
Section titled “3. Receive Fiat”Once confirmed and processed, the funds will arrive in the connected account.
- The wire is marked as
completed
. - A
wire.completed
webhook is triggered with full transaction details. - The user receives fiat in their connected bank account or payout method.
Important Notes
Section titled “Important Notes”- Use the wireId returned from creation to fetch status, generate receipts, or view history.
- Stablecoin transfers must be approved and submitted from a compatible wallet.
- Connected accounts must be verified and support the selected fiat currency.
- Use webhooks for real-time updates, or poll the status endpoint if needed.