Skip to content

API Overview

The Crypto Payment Gateway provides a comprehensive RESTful API for managing cryptocurrency transactions, addresses, and wallets.

Interactive API Testing

This overview page provides interactive examples you can test in real time! Enter your API key in the fields below and click the "Test" buttons to send requests to the server https://cp-merch-dev.wsdemo.online/api.

If you encounter CORS errors:

  • Use the "📋 Copy curl" buttons to get ready-to-use commands
  • Execute commands in terminal or use Postman
  • Install a browser extension to disable CORS (e.g., "CORS Unblock")

Base URL

Production:

https://api.your-gateway.com/api/v1

Demo/Testing:

https://cp-merch-dev.wsdemo.online/api

Demo Environment

Use the demo environment for testing and development. The demo API includes sample data and doesn't process real transactions.

OpenAPI Documentation: https://cp-merch-dev.wsdemo.online/api/openapi/

Authentication

All API requests require authentication using one of the following methods:

  • API Key - Include X-Api-Key header with your API key
  • API Key - Include X-Api-Key: <token> header

API Versioning

Our API uses URI versioning. The current version is v1, which is included in all endpoint URLs:

/api/v1/addresses
/api/v1/networks
/api/v1/withdrawals

Content Type

All API requests and responses use JSON format:

http
Content-Type: application/json

Rate Limiting

API requests are rate-limited to ensure fair usage:

  • Standard endpoints: 1000 requests per minute
  • Webhook endpoints: 100 requests per minute
  • Admin endpoints: 500 requests per minute

Rate limit headers are included in all responses:

http
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 999
X-RateLimit-Reset: 1640995200

Error Handling

The API uses standard HTTP status codes:

  • 200 OK - Request successful
  • 201 Created - Resource created successfully
  • 400 Bad Request - Invalid request parameters
  • 401 Unauthorized - Authentication required
  • 403 Forbidden - Insufficient permissions
  • 404 Not Found - Resource not found
  • 429 Too Many Requests - Rate limit exceeded
  • 500 Internal Server Error - Server error

Error Response Format

json
{
  "error": {
    "code": "INVALID_PARAMETER",
    "message": "The provided network slug is invalid",
    "details": [
      {
        "field": "network",
        "value": "invalid-network",
        "constraints": {
          "isNotExisting": "Network invalid-network does not exist"
        }
      }
    ]
  }
}

Core Resources

Addresses

Manage cryptocurrency addresses and wallets.

Key endpoints:

  • POST /addresses - Create new address
  • GET /addresses/{address} - Get address details
  • GET /addresses/hot-wallet/{network} - Get hot wallet balance
  • GET /addresses/cold-wallet/{network} - Get cold wallet balance

Networks

Configure and manage blockchain networks.

Key endpoints:

  • GET /networks - List all networks
  • GET /networks/{network} - Get network details
  • PUT /networks - Configure network settings
  • GET /networks/last-number-blocks - Get latest block numbers

Withdrawals

Process cryptocurrency withdrawals.

Key endpoints:

  • POST /withdrawals - Initiate withdrawal
  • GET /withdrawals/requests - List withdrawal requests
  • PUT /withdrawals/request/accept - Accept withdrawal
  • PUT /withdrawals/request/reject - Reject withdrawal

Transactions

Query transaction history and details.

Key endpoints:

  • GET /transactions - List transactions
  • GET /transactions/{txId} - Get transaction details
  • GET /transactions/address/{address} - Get address transactions

Interactive API Explorer

API Configuration

Quick API Tests

Try our API endpoints directly in your browser:

SDK Libraries

We provide official SDK libraries for popular programming languages:

Go SDK

go
import "github.com/your-org/crypto-gateway-go"

client := gateway.NewClient("your-api-key")
address, err := client.CreateAddress("ethereum", "")

TypeScript SDK

typescript
import { CryptoGateway } from '@your-org/crypto-gateway-ts';

const client = new CryptoGateway('your-api-key');
const address = await client.createAddress('ethereum');

Python SDK

python
from crypto_gateway import CryptoGateway

client = CryptoGateway('your-api-key')
address = client.create_address('ethereum')

Webhooks

Stay updated with real-time notifications:

json
{
  "event": "transaction.confirmed",
  "data": {
    "txId": "0x123...",
    "address": "0xabc...",
    "amount": "1.5",
    "coin": "ethereum",
    "confirmations": 12
  },
  "timestamp": "2024-01-15T10:30:00Z"
}

Next Steps

Released under the MIT License.