Instructions for connecting to the API Reseller system

Create order: 

<?php
// Path to the API to connect to
$apiUrl = "https://whmcsnulled.com/api/reseller/create-order";
// Reseller token taken from reseller account management page
$apiToken = "API_TOKEN";
// List ID of products and quantity to submit to API. If the quantity value is empty it will be 1
$products = [
['id' => 2, 'quantity' => 1],
['id' => 6, 'quantity' => 1],
['id' => 1, 'quantity' => 1]
];
$postData = [
'products' => $products
];
$jsonData = json_encode($postData);
$ch = curl_init($apiUrl);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'Authorization: ' . $apiToken,
'Content-Length: ' . strlen($jsonData)
]);

$response = curl_exec($ch);

if (curl_errno($ch)) {
echo 'Error cURL: ' . curl_error($ch);
} else {
$decodedResponse = json_decode($response, true);

if (isset($decodedResponse['error'])) {
echo 'Error API: ' . $decodedResponse['error'];
} else {
echo 'Success: ';
print_r($decodedResponse);
}
}
curl_close($ch);

Show Product List: 

$apiUrl = 'https://whmcsnulled.com/api/reseller/products';
$apiToken = 'API_TOKEN';

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => $apiUrl,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: $apiToken",
"Accept: application/json"
]
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
$data = json_decode($response, true);
print_r($data);
}

Show Reseller Info:

$apiUrl = 'https://whmcsnulled.com/api/reseller/info';
$apiToken = 'API_TOKEN';

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => $apiUrl,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: $apiToken",
"Accept: application/json"
]
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
$data = json_decode($response, true);
print_r($data);
}