Comprar número extra (On Demand)
Compra N número(s) extra(s). Requer key escopada a TENANT. Tenant Grátis é convertido para On Demand (cobra o número grátis convertido + o novo) — exige confirm:true, senão retorna 409 CONFIRMATION_REQUIRED com a prévia. Cobra o valor proporcional na hora — primeiro os créditos da carteira, o restante no cartão salvo (Planos → Cartão). Nunca devolve link de checkout: sem créditos suficientes e sem cartão salvo, retorna 402 INSUFFICIENT_FUNDS e não cobra nada; cartão recusado é 402 PAYMENT_FAILED; falha no processador é 502 PAYMENT_PROVIDER_ERROR. Efeito real: cobra de verdade. Só Stripe.
Requer uma chave com escopo de 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
}Autorizações
Sua chave de API ps_
Corpo
Resposta
Comprou 1 número extra num plano que já é On Demand, com metade do ciclo restante. O custo proporcional saiu primeiro dos créditos da carteira e o resto do cartão salvo (creditsUsed + cardCharged = proratedTotal); paidExtraNumbers já conta a vaga nova. plan é o plano que a conta tinha antes desta chamada, e monthlyTotalBRL precifica só a quantity pedida: numa conversão Free → On Demand eles vêm FREE e 1 × o preço unitário, embora 2 números passem a ser cobrados dali em diante.
Esta página foi útil?
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
}