PAYMENTS - DOMAIN - CREATE DOMAIN ORDER

Payments - Domain - Create Domain Order API Endpoints

Complete documentation for all Payments - Domain - Create Domain Order related endpoints.

POST

Create Domain Order

Create a new domain registration order. The request must be sent as application/x-www-form-urlencoded.

Endpoint Details

HTTP Request
POST https://0xhost.com/API/orders/create_order
Parameters
Parameter Type Required Description
user_id string Yes User UUID
domain_name string Yes Domain name to register
password string No Account password
domain_suffix string Yes Domain suffix (.com, .net, etc.)
vyear integer Yes Registration term in years
Authentication
API Key Required in header
Headers
Header Value Required Description
x-api-key your_api_key_here Yes Your unique API key for authentication
Content-Type application/json Optional Recommended for consistent response handling

Response Fields

Field Type Description
success boolean Indicates if the operation was successful
message string Response message describing the result
data object/array Contains the response data

Success Response

API Response Example
{
    "success": true,
    "data": {
        "id": "30ebab30-18cf-11f1-8da8-525400792197",
        "status": "pending",
        "metadata": "password=randompassword",
        "amount": "20.00",
        "currency": "EUR"
    },
    "domain": null
}

Code Examples

Programming Languages
JavaScript (Fetch API)
async function makeRequest() {
  try {
    const response = await fetch('https://0xhost.com/API/orders/create_order', {
      method: 'POST',
      headers: {
        'x-api-key': 'your_api_key_here',
        'Content-Type': 'application/x-www-form-urlencoded'
      },
      body: new URLSearchParams({
          "user_id": "user_id",
          "domain_name": "yourdomain.com",
          "password": "randompassword",
          "domain_suffix": "com",
          "vyear": "1"
      })
    });

    const data = await response.json();
    console.log('Response:', data);
    return data;
  } catch (error) {
    console.error('Error:', error);
  }
}
Python (Requests)
import requests
import json

def make_request(api_key):
    url = 'https://0xhost.com/API/orders/create_order'
    headers = {
        'x-api-key': api_key,
        'Content-Type': 'application/x-www-form-urlencoded'
    }
    data = {
        "user_id": "user_id",
        "domain_name": "yourdomain.com",
        "password": "randompassword",
        "domain_suffix": "com",
        "vyear": "1"
    }

    response = requests.POST(
        url,
        headers=headers,
        data=data
    )

    if response.status_code == 200:
        return response.json()
    else:
        print(f'Error: {response.status_code}')
        return None
PHP (cURL)
function makeRequest($apiKey) {
    $url = 'https://0xhost.com/API/orders/create_order';
    $data = {
        "user_id": "user_id",
        "domain_name": "yourdomain.com",
        "password": "randompassword",
        "domain_suffix": "com",
        "vyear": "1"
    };

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
    curl_setopt($ch, CURLOPT_HTTPHEADER, [
        'x-api-key: ' . $apiKey,
        'Content-Type: application/x-www-form-urlencoded'
    ]);
    curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));

    $response = curl_exec($ch);
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);

    return json_decode($response, true);
}
cURL Command
curl -X POST \
  'https://0xhost.com/API/orders/create_order' \
  -H 'x-api-key: your_api_key_here' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'user_id=user_id&domain_name=yourdomain.com&password=randompassword&domain_suffix=com&vyear=1'