Buys an server under your Sive.Host account. For more flow control, this method will Automatically setup the product bought as soon as your Sive.Host credit is more than the cost of the server. When you call this method, you must understand that that your credit will be reduced by the amount the server costs. One item can be bought per API call.
Request Parameters
Parameter |
Type |
Description |
Required |
action |
string |
“BuyNow” |
Required |
pid |
string |
The product code as per Product codes page. eg. lomamiriver, benueriver, okavangoriver, kuneneriver, shebelleriver, kasairiver |
Required |
api_key |
string |
API key credentials as per Authentication instructions |
Required |
api_secret |
string |
API secret credentials as per Authentication instructions |
Required |
billingcycle |
string |
The billing cycle for the product. eg. monthly |
Required |
os |
string |
The operating system code as per Operating system codes page. eg. ubuntu24lts, ubuntu22lts, ubuntu20lts, rocky8, alma8, debian12 |
Required |
hostname |
string |
The hostname of the server for VPS/LXC Server orders |
Required |
rootpw |
string |
The desired root password for the VPS/LXC server. |
Required |
username |
string |
The desired username for the VPS/LXC server. |
Required |
sshkey |
string |
The desired SSH Key to be uploaded onto your server |
Optional |
nameserver1 |
string |
The first nameserver to apply. eg. ns1.hostname.com |
Optional |
nameserver2 |
string |
The second nameserver to apply. eg. ns2.hostname.com |
Optional |
Response Parameters
Parameter |
Type |
Description |
result |
string |
The result of the operation: success or error |
orderid |
int |
The Order ID for the by the succesful purchase. |
serviceid |
string |
The Service ID created by the succesful purchase. |
invoiceid |
int |
The Invoice ID created by the succesful purchase. |
Example Request (CURL)
<?php
//Invalid Payment Method. Valid options include pai,banktransfer,metamaskusdterc20,paypal,payfast
$apiUrl = 'https://sive.host/includes/sivehost-api.php'; // Change to your API endpoint
$username = 'Ikhaka'; // Your API username
$password = 'Mph#th9mi$'; // Your API password
$postfields = array(
'api_key' => 'G2dskdXb7BlDwlvbrD1zVEe5ZKQIybXn', // If needed
'api_secret' => 'CtIJVZf8OM1p4iLxwiKFjlU4bPVmEycS', // If needed
'action' => 'BuyNow',
'pid' => 'benueriver',
'os' => 'alma8',
'hostname' => 'ikhaka',
'username' => 'mandela',
'rootpw' => 'MyStrongpassword',
'sshkey' => 'ssh-rsa AAAAB3NzaC1yc2E...CKM= sivehost@Sive',
'billingcycle' => 'monthly',
'nameserver1' => 'ns1.hostname.com',
'nameserver2' => 'ns2.hostname.com',
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $apiUrl);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postfields));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password"); // Basic Authentication
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // Use true in production with a valid SSL
$response = curl_exec($ch);
// Check for cURL errors
if (curl_errno($ch)) {
echo 'cURL Error: ' . curl_error($ch);
}
curl_close($ch);
// Output response
echo $response;
?>
Example Response JSON
{
"result": "success",
"orderid": 13026,
"serviceid": "12632",
"invoiceid": 113690
}
Error Responses
Error Message |
Cause |
Unauthorized access! |
Request from unauthorized IP |
Invalid API Key or secret. |
Incorrect API credentials |
Invalid Product or Operating System. |
Unknown product or Operating System for that product |
Missing action parameter. |
action not specified eg. BuyNow |
Insufficient credit to place the order. |
Not enough account balance. Load credit on Sive.Host client area. |
Invalid Payment Method. Valid options include |
Payment method not specified on payload. |
Version History
Version |
Changelog |
1.0 |
Initial Version |