Integrating Developer-FirstCrypto Payment Rails

Everything you need to integrate crypto payments. Clear documentation, working code examples, and APIs designed by developers, for developers.

B2B Stablecoin Settlement API & SDKs

Everything you can do with CryptoRails, in one place

POST/v1/wallets

Create a new deposit wallet for your customer

Generate a unique address so you know exactly who paid

Request
{
  "network": "ethereum",
  "label": "user_123_deposit",
  "callback_url": "https://your-app.com/webhooks"
}
Response
{
  "id": "wal_abc123",
  "address": "0x742d35Cc6634C0532925a3b844Bc9e7595f...",
  "network": "ethereum",
  "label": "user_123_deposit",
  "created_at": "2024-01-15T10:30:00Z"
}
GET/v1/wallets/{wallet_id}

Get wallet details and current balance

Check if your customer has paid without refreshing block explorer

Response
{
  "id": "wal_abc123",
  "address": "0x742d35Cc6634C0532925a3b844Bc9e...",
  "network": "ethereum",
  "balance": "1000.00",
  "currency": "USDT",
  "last_activity": "2024-01-15T11:00:00Z"
}
GET/v1/transactions

List all transactions with filtering

Get a complete history for reconciliation and reporting

Response
{
  "data": [
    {
      "id": "txn_xyz789",
      "wallet_id": "wal_abc123",
      "type": "deposit",
      "amount": "500.00",
      "currency": "USDT",
      "status": "confirmed",
      "tx_hash": "0x..."
    }
  ],
  "has_more": true
}
POST/v1/consolidate

Move funds from wallets to your treasury

Collect funds from multiple wallets in one API call

Request
{
  "source_wallets": ["wal_abc123", "wal_def456"],
  "destination": "treasury_main",
  "amount": "all"
}
Response
{
  "id": "cons_abc123",
  "status": "processing",
  "transactions": [
    { "from": "wal_abc123", "amount": "500.00", "tx_hash": "0x..." },
    { "from": "wal_def456", "amount": "300.00", "tx_hash": "0x..." }
  ]
}

Webhook Trigger Logic & Automation Workflows

Native libraries that feel right at home in your stack

JSNode.js
npm install @cryptorails/sdk
import { CryptoRails } from '@cryptorails/sdk';

const client = new CryptoRails(process.env.CRYPTORAILS_API_KEY);

// Generate a wallet for a new user
async function onUserSignup(userId: string) {
  const wallet = await client.wallets.create({
    network: 'ethereum',
    label: `user_${userId}_deposit`
  });
  
  // Save wallet.address to your database
  await db.users.update(userId, { 
    depositAddress: wallet.address 
  });
  
  return wallet;
}

// Handle incoming payment webhook
client.webhooks.on('payment.confirmed', async (event) => {
  const { wallet_id, amount, currency } = event.data;
  
  // Credit user account
  await db.transactions.create({
    walletId: wallet_id,
    amount,
    currency,
    status: 'completed'
  });
  
  // Notify user
  await sendEmail(user.email, 'Payment received!');
});
PYPython
pip install cryptorails
from cryptorails import CryptoRails
import os

client = CryptoRails(os.environ['CRYPTORAILS_API_KEY'])

# Generate a wallet for a new merchant
def setup_merchant(merchant_id: str):
    wallet = client.wallets.create(
        network='tron',  # Low fees for merchants
        label=f'merchant_{merchant_id}'
    )
    
    # Store the address
    db.merchants.update(merchant_id, {
        'deposit_address': wallet.address
    })
    
    return wallet

# Check merchant balance
def get_merchant_balance(wallet_id: str):
    wallet = client.wallets.get(wallet_id)
    return {
        'balance': wallet.balance,
        'currency': wallet.currency,
        'pending': wallet.pending_balance
    }

# Consolidate funds daily
def daily_consolidation():
    wallets = client.wallets.list(min_balance='100')
    
    result = client.consolidation.create(
        source_wallets=[w.id for w in wallets],
        destination='treasury_main'
    )
    
    return result
GOGo
go get github.com/cryptorails/cryptorails-go
package main

import (
    "context"
    "log"
    "os"
    
    cryptorails "github.com/cryptorails/cryptorails-go"
)

func main() {
    client := cryptorails.NewClient(os.Getenv("CRYPTORAILS_API_KEY"))
    ctx := context.Background()

    // Create wallet for exchange user
    wallet, err := client.Wallets.Create(ctx, &cryptorails.WalletParams{
        Network: "bsc",
        Label:   "exchange_user_deposit",
    })
    if err != nil {
        log.Fatal(err)
    }

    log.Printf("Wallet created: %s", wallet.Address)

    // List recent transactions
    txns, err := client.Transactions.List(ctx, &cryptorails.ListParams{
        Limit:  50,
        Status: "confirmed",
    })
    if err != nil {
        log.Fatal(err)
    }

    for _, txn := range txns.Data {
        log.Printf("Transaction: %s %s", txn.Amount, txn.Currency)
    }
}

Programmatic Token Tracking & Circulating Supply APIs

Get notified the instant something happens

🔔payment.received

A payment has been detected on-chain (0 confirmations)

Use case: Show pending status to user immediately

✅payment.confirmed

Payment has reached required confirmations

Use case: Credit user account, fulfill order

📤consolidation.initiated

Fund sweep has started processing

Use case: Log for audit, update dashboard

💰consolidation.completed

Funds successfully moved to treasury

Use case: Update treasury balance, close batch

🆕wallet.created

New wallet address generated

Use case: Sync with your user database

Webhook Payload Example

Every webhook includes everything you need to process the event

{
  "id": "evt_abc123xyz",
  "event": "payment.confirmed",
  "created_at": "2024-01-15T10:30:00Z",
  "data": {
    "wallet_id": "wal_xyz789",
    "transaction_id": "txn_def456",
    "amount": "1000.00",
    "currency": "USDT",
    "network": "ethereum",
    "tx_hash": "0x742d35Cc6634C0532925a3b844Bc9e7595f...",
    "confirmations": 12,
    "from_address": "0x123...",
    "block_number": 18500000
  },
  "signature": "sha256=abc123..."  // Verify this!
}

Getting Started

From zero to accepting payments in 15 minutes

1Get Your API Key

Contact our team to receive your sandbox and production API keys.

# Store your API key securely
export CRYPTORAILS_API_KEY="cr_live_abc123..."

2Make Your First Request

Test the connection by creating a wallet.

curl -X POST "https://api.cryptorails.tech/v1/wallets" \
  -H "Authorization: Bearer $CRYPTORAILS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"network": "ethereum", "label": "test_wallet"}'

3Set Up Webhooks

Configure your endpoint to receive payment notifications.

// Express.js webhook handler
app.post('/webhooks/cryptorails', (req, res) => {
  const event = req.body;
  
  if (event.event === 'payment.confirmed') {
    // Process the payment
    handlePayment(event.data);
  }
  
  res.status(200).send('OK');
});

4Go Live

Switch to production keys and start accepting real payments.

# Sandbox (testing)
CRYPTORAILS_API_KEY="cr_test_..."

# Production (real money)
CRYPTORAILS_API_KEY="cr_live_..."

Ready to Start Building?

Get your API keys and start integrating CryptoRails today. Our team is here to help.