Comprar un número adicional (On Demand)
Compra N número(s) extra. Requiere una clave de alcance TENANT. Un tenant Free se convierte a On Demand (cobra el número gratuito convertido + el nuevo): requiere confirm:true; de lo contrario devuelve 409 CONFIRMATION_REQUIRED con la vista previa. El costo prorrateado se cobra de inmediato: primero los créditos de la billetera, el resto en la tarjeta guardada (Plans → Cartão). Nunca devuelve un enlace de checkout: sin créditos suficientes ni tarjeta guardada devuelve 402 INSUFFICIENT_FUNDS y no cobra nada; una tarjeta rechazada es 402 PAYMENT_FAILED; una falla del procesador es 502 PAYMENT_PROVIDER_ERROR. Efecto real: cobra. Solo Stripe.
Rol con una clave de cuenta o token OAuth: Owner (billing:manage).
Requiere una clave de alcance tenant.
curl --request POST \
--url https://pilotstatus.com.br/v1/subscription/extra-numbers \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"quantity": 1,
"confirm": true
}
'import requests
url = "https://pilotstatus.com.br/v1/subscription/extra-numbers"
payload = {
"quantity": 1,
"confirm": True
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({quantity: 1, confirm: true})
};
fetch('https://pilotstatus.com.br/v1/subscription/extra-numbers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://pilotstatus.com.br/v1/subscription/extra-numbers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'quantity' => 1,
'confirm' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://pilotstatus.com.br/v1/subscription/extra-numbers"
payload := strings.NewReader("{\n \"quantity\": 1,\n \"confirm\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://pilotstatus.com.br/v1/subscription/extra-numbers")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"quantity\": 1,\n \"confirm\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pilotstatus.com.br/v1/subscription/extra-numbers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"quantity\": 1,\n \"confirm\": true\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"charged": true,
"plan": "ON_DEMAND",
"paidExtraNumbers": 3,
"proratedTotal": 14.95,
"currency": "BRL",
"creditsUsed": 10,
"cardCharged": 4.95,
"monthlyTotalBRL": 29.9
}Encabezados
Opcional. Deduplica un reintento: la misma clave con el mismo cuerpo dentro de 24 horas devuelve el resultado ORIGINAL (mismo cuerpo, sin segundo cobro, sin segundo espacio). Si la omites, cada POST es una compra nueva. Hasta 255 caracteres, sin caracteres de control (si no, 400 IDEMPOTENCY_KEY_INVALID); un valor en blanco cuenta como ausente. No protege dos solicitudes enviadas al mismo tiempo, y la misma clave con otra quantity es otra compra.
255Cuerpo
Respuesta
Se compró 1 número extra en un plan que ya es On Demand, con la mitad del ciclo restante. El costo prorrateado se tomó primero de los créditos de la billetera y el resto de la tarjeta guardada (creditsUsed + cardCharged = proratedTotal); paidExtraNumbers ya cuenta el nuevo espacio. plan es el plan que tenía la cuenta antes de esta llamada, y monthlyTotalBRL cotiza solo la quantity que pediste: en una conversión Free → On Demand muestran FREE y 1 × el precio unitario, aunque a partir de entonces se cobran 2 números.
¿Esta página le ayudó?
curl --request POST \
--url https://pilotstatus.com.br/v1/subscription/extra-numbers \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"quantity": 1,
"confirm": true
}
'import requests
url = "https://pilotstatus.com.br/v1/subscription/extra-numbers"
payload = {
"quantity": 1,
"confirm": True
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({quantity: 1, confirm: true})
};
fetch('https://pilotstatus.com.br/v1/subscription/extra-numbers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://pilotstatus.com.br/v1/subscription/extra-numbers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'quantity' => 1,
'confirm' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://pilotstatus.com.br/v1/subscription/extra-numbers"
payload := strings.NewReader("{\n \"quantity\": 1,\n \"confirm\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://pilotstatus.com.br/v1/subscription/extra-numbers")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"quantity\": 1,\n \"confirm\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pilotstatus.com.br/v1/subscription/extra-numbers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"quantity\": 1,\n \"confirm\": true\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"charged": true,
"plan": "ON_DEMAND",
"paidExtraNumbers": 3,
"proratedTotal": 14.95,
"currency": "BRL",
"creditsUsed": 10,
"cardCharged": 4.95,
"monthlyTotalBRL": 29.9
}