Skip to main content

Scenario

A user wants to sell Bitcoin or USDC and receive cash in their local bank account (e.g., Brazil PIX) immediately.

Workflow

1. Generate Deposit Address

First, you need to generate a deposit address for the user to send their crypto. You can generate a Lightning invoice for Bitcoin or an on-chain address for other cryptocurrencies (e.g., USDC on Solana).

Option A: Bitcoin (Lightning)

Generate a Lightning invoice for a specific amount.
See the Lightning Deposit API reference for full details.
curl --request POST \
  --url https://api.bullring.finance/v1/ramp/{subaccountId}/banking/deposits/lightning \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer <token>' \
  --data '{
  "amount": 50,
  "currency": "usd",
  "note": "Deposit for withdrawal"
}'
Response:
{
  "lightningInvoice": "lntbs108...",
  "id": "5567cac1-d7bc-4b0d-980d-8c2453dc952c",
  "paymentHash": "5bd0d584d9d24693ed81e000b6b252b137166a562fd2fd65e4e376f73b4845c8",
  "paymentRequestAmount": 50,
  "paymentRequestCurrency": "usd",
  "invoiceCurrency": "stablesats",
  "status": "unpaid",
  "createdAt": "2025-11-20T01:47:08.282Z"
}

Option B: USDC (On-Chain)

Get a deposit address for a supported blockchain (e.g., SOL-MAINNET-BETA).
See the Onchain Deposit API reference for full details.
curl --request GET \
  --url https://api.bullring.finance/v1/ramp/{subaccountId}/banking/deposits/crypto/SOL-MAINNET-BETA \
  --header 'Authorization: Bearer <token>'
Response:
{
  "id": "f156b4cb-9b34-4c45-bed1-92576c703412",
  "address": "DnXn...",
  "chain": "SOL-MAINNET-BETA",
  "currency": "USDC",
  "createdAt": "2025-11-21T11:17:42.575Z"
}

2. Monitor for Deposit

Wait for the deposit to be confirmed. Bullring will send a webhook event when the funds are credited to the subaccount. For details on the event payload, see Deposit Events.

3. Instant Withdrawal

Once the funds are available in the subaccount, trigger a withdrawal to the user’s local bank account.
See the Withdraw Fiat API reference for full details.

Example: Withdraw to Brazil (PIX)

curl --request POST \
  --url https://api.bullring.finance/v1/ramp/{subaccountId}/banking/withdrawals \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer <token>' \
  --data '{
  "account_id": "123.456.789-00",
  "amount": "50",
  "currency": "BRL"
}'
Response:
{
  "id": "856b896f-3f16-4f70-952d-ce1f65b28aaa",
  "amount": "50",
  "currency": "BRL",
  "status": "pending",
  "created_at": "2025-11-21T15:59:09.341Z",
  "fee_amount": "0.00",
  "fee_currency": "BRL"
}