logo

API Keys Documentation

Managing Your API Keys

API Keys are required to interact with DashX APIs. You can create, regenerate, and delete API Keys from your dashboard.

How to Create an API Key

  1. Go to the DashX Dashboard.
  2. Login with your DashX account.
  3. Navigate to Developer in the sidebar menu
  4. Click the Generate on the top-right.
  5. api-key-gen
  6. Enter a name for your API Key and click Generate Key.
  7. You will receive an API Secret Key. Save this key securely as it will only be visible once.

Using API Keys

Authentication

X-API-KEY: dshx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
X-MERCHANT-ID: your_merchant_id

The X-MERCHANT-ID header is required for API authentication. You can find your merchant ID when generating an API key in gateway.

Supported Endpoints

1. Payment Links

POST /payment-link/
X-API-KEY: dshx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
X-MERCHANT-ID: your_merchant_id

{
  "link_type": "FIXED",
  "token": "USDC",
  "accepted_chain_symbols": ["SOL", "MATIC", "ARB", "ETH"],
  "amount": "10.00",
  "title": "Payment Title",
  "description": "Payment Description",
  "collect_email": true,
  "customer_id": "your_customer_id",
  "merchant": "your_merchant_id"
}

The customer_id field is optional. When provided, it will automatically map payments to the specified customer in your database.

Response

// Success Response (200 OK)
{
    "message": "Payment link created successfully",
    "id": "payment_id",
    "slug": "payment_slug",
    "link": "https://gateway.dashx.xyz/gateway?slug=payment_slug,
    "customer_id": "your_customer_id"
}

// Error Response (400 Bad Request)
{
  "success": false,
  "error": "Invalid amount format"
}

2. Payment Status

GET /payment-link/by-slug/?slug={payment_link_slug}
X-API-KEY: dshx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
X-MERCHANT-ID: your_merchant_id

Response

// Success Response (200 OK)
{
  "id": "pl_1234567890abcdef",
  "merchant": "merch_1234567890abcdef",
  "link_type": "FIXED",
  "product": null,
  "payment_walletset": "wset_1234567890abcdef",
  "token": "USDC",
  "accepted_chain_symbols": ["SOL", "MATIC", "ARB", "ETH"],
  "amount": "50.00",
  "title": "Premium Subscription",
  "description": "Monthly premium subscription payment",
  "image": "",
  "created_at": "2024-03-15T10:30:00Z",
  "expires_at": "2024-04-15T10:30:00Z",
  "slug": "premium-subscription-xyz123",
  "collect_name": true,
  "collect_email": true,
  "collect_phone": false,
  "collect_billing": false,
  "confirmation_message": "Thank you for your payment!",
  "redirect_url": "https://example.com/thank-you",
  "is_active": true,
  "call_to_action": "Subscribe Now",
  "allow_promo_codes": true,
  "available_addresses": [
    "0x1234567890abcdef1234567890abcdef12345678",
    "AbCdEfGhIjKlMnOpQrStUvWxYz1234567890"
  ],
  "customer_id": "cust_1234567890abcdef",
  "wallet_allocation_status": "completed",
  "wallet_allocation_error": null,
  "wallet_addresses": "{"ARB": "0x1234567890abcdef1234567890abcdef12345678", "MATIC": "0x1234567890abcdef1234567890abcdef12345678", "ETH": "0x1234567890abcdef1234567890abcdef12345678"}",
  "temp_sca_wallet": "0x1234567890abcdef1234567890abcdef12345678",
  "merchant_solana_address": "AbCdEfGhIjKlMnOpQrStUvWxYz1234567890"
}

// Error Response (400 Bad Request)
{
  "error": "Payment link not found"
}

3. Payment Statistics

GET /payment-stats/
X-API-KEY: dshx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
X-MERCHANT-ID: your_merchant_id

Response

// Success Response (200 OK)
{
  "total_volume": 1250.75,
  "total_payments": 42,
  "average_payment": 29.78,
  "total_fees": 12.51,
  "unique_customers": 38,
  "payment_methods": ["SOL", "MATIC", "ARB", "ETH"],
  "daily_stats": [
    {
      "date": "2024-03-15",
      "count": 8,
      "volume": 238.50
    },
    {
      "date": "2024-03-14",
      "count": 12,
      "volume": 356.75
    },
    {
      "date": "2024-03-13",
      "count": 6,
      "volume": 179.25
    },
    {
      "date": "2024-03-12",
      "count": 9,
      "volume": 268.00
    },
    {
      "date": "2024-03-11",
      "count": 7,
      "volume": 208.25
    }
  ]
}

// Error Response (400 Bad Request)
{
  "error": "Invalid date range"
}

Common Error Responses

// 401 Unauthorized
{
  "error": "Authentication required"
}

// 403 Forbidden
{
  "error": "Insufficient permissions"
}

// 500 Internal Server Error
{
  "error": "Internal server error"
}