Skip to main content

Testnet API - Build Any Financial Flow

Think of Testnet API as your Lego blocks for financial flows. Each endpoint is a building block that you can combine to create different payment scenarios - from simple fiat-to-crypto onramps to complex cross-border transfers.

๐ŸŽฏ What Can You Build?โ€‹

Instead of rigid, predefined flows, you get flexible building blocks that work together:

  • Fiat Entry Points: Convert real money into USDC
  • Transfer Bridges: Move money between wallets and chains
  • Fiat Exit Points: Convert USDC back to real money
  • Tracking Tools: Monitor and log your transactions

๐Ÿงฉ Your Building Blocksโ€‹

๐Ÿ’ฐ Money Input Blocksโ€‹

  • POST /testnet/onramp - Bring fiat money into the system as USDC
  • POST /testnet/deposit/confirm - Convert USDC deposits into fiat wallets

๐Ÿ”„ Transfer & Bridge Blocksโ€‹

  • POST /testnet/onrampwallet - Move money between internal wallets
  • POST /testnet/send-usd - Send USD across borders using USDC as bridge
  • POST /testnet/send-usdc-direct - Send USDC directly to any blockchain address

๐Ÿ“Š Discovery & Management Blocksโ€‹

  • GET /testnet/listwalletUsd - Find other users' wallets for testing
  • GET /testnet/mywalletUsd - Get your own USD wallet info
  • POST /testnet/log-user-transfer - Track external wallet transactions

โš™๏ธ Infrastructure Blocksโ€‹

  • POST /testnet/chain - Check which blockchain networks are available

๐Ÿ—๏ธ Common Building Patternsโ€‹

Pattern 1: "I want to test fiat-to-crypto onramp"โ€‹

Fiat Money โ†’ onramp โ†’ USDC on blockchain

Use: /testnet/onramp

Pattern 2: "I want to test cross-border money transfer"โ€‹

USD Wallet โ†’ send-usd โ†’ USDC bridge โ†’ USD Wallet (different country)

Use: /testnet/send-usd

Pattern 3: "I want to test crypto-to-fiat offramp"โ€‹

USDC on blockchain โ†’ deposit/confirm โ†’ Fiat in wallet

Use: /testnet/deposit/confirm

Pattern 4: "I want to test complete money journey"โ€‹

Fiat โ†’ onramp โ†’ USDC โ†’ transfer โ†’ USDC โ†’ offramp โ†’ Fiat

Use: Combine multiple endpoints


๐Ÿ”ง Building Block Detailsโ€‹

Fiat to USDC Onrampโ€‹

POST/api/testnet/onramp

Convert Fiat Money to USDC

Your first building block - converts real money (IDR, USD, etc.) into USDC that lives on the Sepolia testnet. Perfect for testing how users would deposit money into your crypto system.

Parameters

amount_idrnumberrequired

How much Indonesian Rupiah to convert (use your local currency)

wallet_idstringrequired

Which wallet should receive the USDC

Request Body

{
  "amount_idr": 150000,
  "wallet_id": "wallet_123456"
}

Response

200Money successfully converted to USDC
{
  "success": true,
  "message": "Your IDR is now USDC on blockchain!",
  "transaction_id": "txn_testnet_1234567890",
  "amount_idr": 150000,
  "amount_usdc": 10,
  "exchange_rate": 15000,
  "wallet_address": "0x153c26a547C35009Ba3fE69a1F9f431B089bB301",
  "network": "sepolia",
  "status": "completed"
}

Cross-Border USD Transferโ€‹

POST/api/testnet/send-usd

Send USD Across Borders via USDC

Your cross-border magic block - takes USD from one wallet, converts to USDC, sends it across blockchain, then converts back to USD in recipient's wallet. Perfect for testing international money transfers.

Parameters

from_wallet_idstringrequired

Sender's USD wallet (where money comes from)

to_wallet_idstringrequired

Recipient's USD wallet (where money goes to)

amountnumberrequired

How much USD to send

Request Body

{
  "from_wallet_id": "wallet_usd_alice",
  "to_wallet_id": "wallet_usd_bob",
  "amount": 75
}

Response

200Money successfully sent across borders
{
  "success": true,
  "message": "USD sent via USDC bridge successfully",
  "transaction_id": "txn_usd_1234567890",
  "from_wallet_id": "wallet_usd_alice",
  "to_wallet_id": "wallet_usd_bob",
  "amount_usd": 75,
  "amount_usdc": 75,
  "recipient_address": "0x153c26a547C35009Ba3fE69a1F9f431B089bB301",
  "step_log": {
    "1_convert_usd_to_usdc": "completed",
    "2_send_usdc_onchain": "completed",
    "3_credit_usd_to_recipient": "completed"
  },
  "status": "completed"
}

USDC to Fiat Conversionโ€‹

POST/api/testnet/deposit/confirm

Convert USDC Back to Fiat Money

Your off-ramp block - takes USDC that someone received and converts it back into real fiat money in their wallet. Complete the money journey from crypto back to traditional currency.

Parameters

user_idnumberrequired

Which user is receiving the money

wallet_addressstringrequired

Where the USDC was received

amountnumber

How much USDC to convert (auto-detected if not provided)

Request Body

{
  "user_id": 123,
  "wallet_address": "0x153c26a547C35009Ba3fE69a1F9f431B089bB301",
  "amount": 100
}

Response

200USDC successfully converted to fiat
{
  "success": true,
  "message": "USDC converted to fiat and credited to wallet",
  "deposit_id": "dep_1234567890",
  "user_id": 123,
  "amount_usdc": 100,
  "amount_fiat": 1500000,
  "currency": "IDR",
  "exchange_rate": 15000,
  "status": "completed"
}

Direct USDC Transferโ€‹

POST/api/testnet/send-usdc-direct

Send USDC Directly to Any Address

Your direct blockchain block - sends USDC straight to any Ethereum address without wallet-to-wallet complexity. Perfect for testing direct crypto payments.

Parameters

evm_addressstringrequired

Any Ethereum-compatible wallet address

amountnumberrequired

How much USDC to send

Request Body

{
  "evm_address": "0x987654321098765432109876543210987654321",
  "amount": 50
}

Response

200USDC sent directly to address
{
  "success": true,
  "message": "USDC sent directly to blockchain address",
  "transaction_id": "txn_direct_1234567890",
  "evm_address": "0x987654321098765432109876543210987654321",
  "amount": 50,
  "currency": "USDC",
  "network": "sepolia",
  "tx_hash": "0xabcdef1234567890abcdef1234567890abcdef12",
  "status": "completed"
}

Wallet Discoveryโ€‹

GET/api/testnet/listwalletUsd

Find Other Users' Wallets for Testing

Your testing helper block - discover other users' USD wallets so you can test transfers between different accounts. Essential for multi-user testing scenarios.

Response

200List of available test wallets
{
  "wallets": [
    {
      "wallet_id": "wallet_usd_alice",
      "username": "alice_doe",
      "address": "0x987654321098765432109876543210987654321",
      "country_code": "SG"
    },
    {
      "wallet_id": "wallet_usd_bob",
      "username": "bob_smith",
      "address": "0x456789012345678901234567890123456789012",
      "country_code": "AU"
    }
  ]
}

Get My Walletโ€‹

GET/api/testnet/mywalletUsd

Get Your Own USD Wallet Info

Your wallet info block - get details about your own USD wallet including balance limits and status. Essential starting point for any wallet operations.

Response

200Your wallet information
{
  "wallet": {
    "wallet_id": "wallet_usd_123",
    "address": "0x123456789012345678901234567890123456789",
    "currency": "USD",
    "wallet_status": "ACTIVE",
    "balance_limit": 10000,
    "created_at": "2024-01-10T08:00:00Z"
  }
}

๐Ÿ” Security & Smart Contract Integrationโ€‹

Why Hardcoded Test Addresses?โ€‹

For testing safety, certain endpoints use hardcoded recipient addresses instead of user-provided ones:

Security Benefits:

  • No risk of user funds being lost
  • No need to handle user private keys
  • Predictable testing environment
  • Production-ready security patterns

Production vs Testing:

// ๐Ÿงช Testing Mode (uses safe hardcoded address)
const testResult = await testnet.onrampTestnet({
amount_idr: 150000,
wallet_id: "my_wallet"
});
// โ†’ USDC goes to: 0x153c26a547C35009Ba3fE69a1F9f431B089bB301

// ๐Ÿš€ Production Mode (user provides their address)
const prodResult = await testnet.sendUsdcDirect({
evm_address: "0xUserProvidedAddress", // User's own wallet
amount: 50.00
});
// โ†’ USDC goes to: User's specified address

Smart Contract Integrationโ€‹

Testnet operates on Sepolia network with these contracts:

Contract TypeAddressPurpose
USDC Token0x9BF350fBaaA8c7200990B051809334c90778f435ERC-20 USDC transfers
Bridge Contract0x432a3Ab53BEe8657cD5E26Bd9A7251Bbd19B3Fb1Cross-chain operations
Test Recipient0x153c26a547C35009Ba3fE69a1F9f431B089bB301Safe testing wallet

Network Details:

๐Ÿš€ Building Complete Flowsโ€‹

Flow 1: Complete Fiat-to-Fiat Journeyโ€‹

// Test the full money journey: IDR โ†’ USDC โ†’ USD
async function testCompleteJourney() {
// Step 1: Convert fiat to USDC
const onramp = await testnet.onrampTestnet({
amount_idr: 300000, // 300k IDR
wallet_id: "my_wallet"
});

// Step 2: Convert USDC back to fiat
const offramp = await testnet.confirmDeposit({
user_id: 123,
wallet_address: onramp.wallet_address,
amount: onramp.amount_usdc
});

console.log(`Journey complete: ${onramp.amount_idr} IDR โ†’ ${onramp.amount_usdc} USDC โ†’ ${offramp.amount_fiat} ${offramp.currency}`);
}

Flow 2: Cross-Border Transfer Testingโ€‹

// Test international money transfer
async function testCrossBorderTransfer() {
// Step 1: Get your wallet and find recipient
const myWallet = await testnet.getMyUsdWallet();
const otherWallets = await testnet.getUserWalletListUsd();

// Step 2: Send money across borders
const transfer = await testnet.sendUsd({
from_wallet_id: myWallet.wallet.wallet_id,
to_wallet_id: otherWallets.wallets[0].wallet_id,
amount: 100.00
});

console.log("Money sent from", myWallet.wallet.address);
console.log("To", otherWallets.wallets[0].username, "in", otherWallets.wallets[0].country_code);
console.log("Transfer steps:", transfer.step_log);
}

Advanced Security Testingโ€‹

// Test security patterns and smart contract integration
async function testSecurityIntegration() {
console.log('๐Ÿ” Testing security and smart contract patterns...');

// 1. Safe testing with controlled addresses
const safeTest = await testnet.onrampTestnet({
amount_idr: 150000,
wallet_id: "test_wallet"
});

console.log(`๐Ÿ’ฐ Safe onramp test completed:`);
console.log(` USDC amount: ${safeTest.amount_usdc}`);
console.log(` Safe address: ${safeTest.wallet_address}`);
console.log(` Network: ${safeTest.network}`);

// 2. Direct address control (production pattern)
const directSend = await testnet.sendUsdcDirect({
evm_address: "0x987654321098765432109876543210987654321",
amount: 25.00
});

console.log(`๐ŸŽฏ Direct USDC transfer:`);
console.log(` Amount: ${directSend.amount} USDC`);
console.log(` To address: ${directSend.evm_address}`);
console.log(` Transaction: ${directSend.tx_hash}`);

// 3. Smart contract details
console.log(`โ›“๏ธ Smart contract integration:`);
console.log(` USDC Contract: 0x9BF350fBaaA8c7200990B051809334c90778f435`);
console.log(` Bridge Contract: 0x432a3Ab53BEe8657cD5E26Bd9A7251Bbd19B3Fb1`);
console.log(` Chain ID: 11155111 (Sepolia)`);

return { safeTest, directSend };
}

๐ŸŽฏ When to Use Which Blockโ€‹

Starting a Test Sessionโ€‹

  1. Get your wallet: GET /testnet/mywalletUsd
  2. Check available networks: POST /testnet/chain
  3. Find test partners: GET /testnet/listwalletUsd

Testing Onramp Scenariosโ€‹

  • Fiat to crypto: POST /testnet/onramp
  • External deposit tracking: POST /testnet/log-user-transfer

Testing Transfer Scenariosโ€‹

  • Internal transfers: POST /testnet/onrampwallet
  • Cross-border fiat: POST /testnet/send-usd
  • Direct crypto: POST /testnet/send-usdc-direct

Testing Offramp Scenariosโ€‹

  • Crypto to fiat: POST /testnet/deposit/confirm

๐Ÿ’ก Pro Tips for Developersโ€‹

Testing Strategyโ€‹

// Always start with wallet discovery
const setup = async () => {
const chains = await testnet.getAvailableChains();
const myWallet = await testnet.getMyUsdWallet();
const testWallets = await testnet.getUserWalletListUsd();

console.log("Test environment ready!");
console.log("Active chains:", chains.chains.filter(c => c.active));
console.log("My wallet:", myWallet.wallet.wallet_id);
console.log("Test partners:", testWallets.wallets.length);
};

Error Handlingโ€‹

// Always wrap in try-catch
try {
const result = await testnet.onrampTestnet({
amount_idr: 150000,
wallet_id: "my_wallet"
});
} catch (error) {
if (error.message.includes('Missing required fields')) {
console.log("Check your parameters");
} else if (error.message.includes('wallet not found')) {
console.log("Wallet doesn't exist - create one first");
}
}

Debugging Flowsโ€‹

// Use step logs for complex flows
const transfer = await testnet.sendUsd({
from_wallet_id: "alice",
to_wallet_id: "bob",
amount: 50
});

// Check each step completed successfully
Object.entries(transfer.step_log).forEach(([step, status]) => {
console.log(`${step}: ${status}`);
});

๐ŸŒ Supported Currencies & Networksโ€‹

Fiat Currenciesโ€‹

Based on your user's country, the system supports:

  • IDR (Indonesia) - Primary testing currency
  • USD (United States) - International standard
  • SGD (Singapore) - Regional testing
  • AUD (Australia) - Regional testing
  • VND (Vietnam) - Regional testing
  • INR (India) - Regional testing

Blockchain Networksโ€‹

  • Sepolia Testnet - Active for all operations
  • Other EVM Networks - Available but currently inactive

Test Environment Constantsโ€‹

  • Exchange Rate: 1 USDC = 15,000 IDR (hardcoded for testing)
  • Test Recipient Wallet: 0x153c26a547C35009Ba3fE69a1F9f431B089bB301 (Safe test wallet for receiving funds)
  • Network: Sepolia Testnet
  • Token Standard: ERC-20 USDC
  • USDC Contract: 0x9BF350fBaaA8c7200990B051809334c90778f435 (Sepolia)

Security Modelโ€‹

  • Never ask users for private keys - All testnet operations use safe, hardcoded addresses
  • Test wallet controlled by BRDZ - Ensures funds don't get lost during testing
  • Production-ready code - Same security patterns work for mainnet deployment

Security Best Practices

Never ask users for private keys in testing or production. Use hardcoded safe addresses for testing, and let users specify their own addresses for production. This testnet demonstrates production-ready security patterns.

Smart Contract Interactions

All USDC operations interact with the ERC-20 contract at 0x9BF350fBaaA8c7200990B051809334c90778f435 on Sepolia. Bridge operations use contract 0x432a3Ab53BEe8657cD5E26Bd9A7251Bbd19B3Fb1. These are testnet-only addresses.

Production Migration

The same security patterns and API structure work for mainnet deployment. Only contract addresses and RPC URLs need to change when moving from testnet to production.