Skip to main content
Version: v0.9

Quick Start Guide (v0.9)

This guide will help you quickly get started with integrating the Cryptofuse API into your application. You'll learn how to create your first payment request and check its status.

Prerequisites

Before you begin, you should have:

Step 1: Set Up Your Development Environment

To make API requests to Cryptofuse, you'll need an HTTP client. This can be a library in your programming language or a tool like cURL or Postman.

Example using cURL

# Install cURL if you don't have it already
# macOS: brew install curl
# Ubuntu/Debian: apt-get install curl
# Windows: Download from https://curl.se/windows/

# Set your API key
API_KEY="your_api_key_here"

Example using Node.js and Axios

// Install Axios
// npm install axios

const axios = require('axios');

// Configure Axios with your API key
const cryptofuse = axios.create({
baseURL: 'https://api.cryptofuse.io/v0',
headers: {
'Content-Type': 'application/json',
'X-API-Key': 'your_api_key_here'
}
});

Step 2: Create a Payment Request

Create your first payment request to accept cryptocurrency payments.

Example using cURL

curl -X POST "https://api.cryptofuse.io/v0/payments" \
-H "Content-Type: application/json" \
-H "X-API-Key: $API_KEY" \
-d '{
"amount_usd": 100.00,
"blockchain": "ETH",
"callback_url": "https://your-site.com/payment/callback",
"custom_id": "ORDER-12345"
}'

Example using Node.js and Axios

async function createPayment() {
try {
const response = await cryptofuse.post('/payments', {
amount_usd: 100.00,
blockchain: "ETH",
callback_url: "https://your-site.com/payment/callback",
custom_id: "ORDER-12345"
});

console.log('Payment created:', response.data);
return response.data;
} catch (error) {
console.error('Error creating payment:', error.response ? error.response.data : error.message);
}
}

createPayment();

Response

{
"payment_id": "550e8400-e29b-41d4-a716-446655440000",
"crypto_amount": 0.05,
"address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"expiry_time": "2025-04-17T13:30:25.123Z",
"token": "USDT",
"blockchain": "ETH"
}

Step 3: Check Payment Status

Once you've created a payment, you'll need to check its status to know when it's been completed.

Example using cURL

PAYMENT_ID="550e8400-e29b-41d4-a716-446655440000"

curl "https://api.cryptofuse.io/v0/payments/$PAYMENT_ID" \
-H "X-API-Key: $API_KEY"

Example using Node.js and Axios

async function checkPaymentStatus(paymentId) {
try {
const response = await cryptofuse.get(`/payments/${paymentId}`);
console.log('Payment status:', response.data);
return response.data;
} catch (error) {
console.error('Error checking payment status:', error.response ? error.response.data : error.message);
}
}

checkPaymentStatus('550e8400-e29b-41d4-a716-446655440000');

Response

{
"payment_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "pending",
"crypto_amount": 0.05,
"address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"expiry_time": "2025-04-17T13:30:25.123Z",
"token": "USDT",
"blockchain": "ETH",
"created_at": "2025-04-17T12:30:25.123Z",
"updated_at": "2025-04-17T12:30:25.123Z"
}

Step 4: Implement Callback Handling (Optional)

If you provided a callback_url when creating the payment, you'll receive updates when the payment status changes. Set up an endpoint to handle these callbacks.

Example Callback Endpoint (Node.js with Express)

const express = require('express');
const bodyParser = require('body-parser');
const app = express();

app.use(bodyParser.json());

app.post('/payment/callback', (req, res) => {
const paymentData = req.body;

console.log('Payment status update:', paymentData);

// Update your database or application state based on the payment status
if (paymentData.status === 'completed') {
// Payment has been confirmed - fulfill the order
// ...
}

// Return a 200 OK response to acknowledge receipt
res.status(200).send({ received: true });
});

app.listen(3000, () => {
console.log('Callback server listening on port 3000');
});

Blockchain Selection

In v0.9, you can choose from the following blockchains:

  • ETH - Ethereum (USDT token)
  • BSC - Binance Smart Chain (USDT token)
  • BTC - Bitcoin (native BTC)
  • TRX - TRON (USDT token)

Each blockchain has different confirmation requirements:

  • BTC: 2 confirmations
  • ETH: 12 confirmations
  • BSC: 15 confirmations
  • TRX: 30 confirmations

Example of creating a payment with Bitcoin:

async function createBitcoinPayment() {
try {
const response = await cryptofuse.post('/payments', {
amount_usd: 100.00,
blockchain: "BTC",
callback_url: "https://your-site.com/payment/callback",
custom_id: "ORDER-BTC-12345"
});

console.log('BTC Payment created:', response.data);
return response.data;
} catch (error) {
console.error('Error creating payment:', error.response ? error.response.data : error.message);
}
}

Next Steps

Now that you've created your first payment request and checked its status, you can:

Support

If you encounter any issues while integrating with the Cryptofuse API, please contact our support team at support@cryptofuse.io.