Get Renewal Price

The getContinueRentPrice method allows you to obtain the current renewal cost of a virtual number through the SMS.online API. This method is used to automate cost calculations before deciding to continue using the number.

The method provides the exact renewal cost for the specified period. This helps in planning expenses in advance and managing your account balance effectively.

A successful request returns an object with information about the renewal cost, including the number ID, renewal period, and amount. This method is recommended for systems with regular number renewals and cost control.

Example Request:

Input Data

ParameterRequiredNoteDescription
YesSee in profile settings API KeyAPI key provides access to paid services
YesgetContinueRentPriceMethod name
YesNumeric valueActivation ID obtained when requesting the number
Yes4, 8, 12, 24, 72, 168, 360, 720, 2160Rental time in hours

Server Response

JSON
{
  "status": "success", 
  "price": "100"
}

Example Code

const api_key = "API_KEY"; # Replace 'API_KEY' with your actual API key.
const id = 1; # Insert the activation ID obtained when requesting the number
const rent_time = 1; # Insert the extension time in hours from the table above
try {
const response = await fetch(`https://api.sms.onlinestubs/handler_api.php?api_key=${api_key}&action=getContinueRentPrice&id=${id}&rent_time=${rent_time}`);
# Make a GET request to the specified URL
const data = await response.json();
# Output the content of the server response
console.log(data);
} catch (err) {
# If an error occurred, output the error message
console.error(err);
}

Possible Errors

ParameterDescription
Invalid action
Invalid API key
Error in query
Time until account is unbanned
Account is inactive
Rental ID not specified
Number rented by someone else (incorrect rental ID)
Invalid extension time
Rental cannot be extended as the number's lifespan has expired
Maximum available time exceeded
Account is blocked