Trocar de Plano
curl --request POST \
--url https://pay.autorizou.dev/api/v1/subscriptions/{id}/change-plan \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"offer_id": "<string>",
"effective": "<string>"
}
'import requests
url = "https://pay.autorizou.dev/api/v1/subscriptions/{id}/change-plan"
payload = {
"offer_id": "<string>",
"effective": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({offer_id: '<string>', effective: '<string>'})
};
fetch('https://pay.autorizou.dev/api/v1/subscriptions/{id}/change-plan', 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://pay.autorizou.dev/api/v1/subscriptions/{id}/change-plan",
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([
'offer_id' => '<string>',
'effective' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://pay.autorizou.dev/api/v1/subscriptions/{id}/change-plan"
payload := strings.NewReader("{\n \"offer_id\": \"<string>\",\n \"effective\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://pay.autorizou.dev/api/v1/subscriptions/{id}/change-plan")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"offer_id\": \"<string>\",\n \"effective\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pay.autorizou.dev/api/v1/subscriptions/{id}/change-plan")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"offer_id\": \"<string>\",\n \"effective\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"effective": "<string>",
"delta": 123,
"next_charge_at": "<string>",
"next_charge_amount": 123,
"proration_payment_id": "<string>"
}Assinaturas
Trocar de Plano
Move uma assinatura para outro plano. Upgrade cobra a diferença; downgrade vira crédito no próximo ciclo.
POST
/
api
/
v1
/
subscriptions
/
{id}
/
change-plan
Trocar de Plano
curl --request POST \
--url https://pay.autorizou.dev/api/v1/subscriptions/{id}/change-plan \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"offer_id": "<string>",
"effective": "<string>"
}
'import requests
url = "https://pay.autorizou.dev/api/v1/subscriptions/{id}/change-plan"
payload = {
"offer_id": "<string>",
"effective": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({offer_id: '<string>', effective: '<string>'})
};
fetch('https://pay.autorizou.dev/api/v1/subscriptions/{id}/change-plan', 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://pay.autorizou.dev/api/v1/subscriptions/{id}/change-plan",
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([
'offer_id' => '<string>',
'effective' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://pay.autorizou.dev/api/v1/subscriptions/{id}/change-plan"
payload := strings.NewReader("{\n \"offer_id\": \"<string>\",\n \"effective\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://pay.autorizou.dev/api/v1/subscriptions/{id}/change-plan")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"offer_id\": \"<string>\",\n \"effective\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pay.autorizou.dev/api/v1/subscriptions/{id}/change-plan")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"offer_id\": \"<string>\",\n \"effective\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"effective": "<string>",
"delta": 123,
"next_charge_at": "<string>",
"next_charge_amount": 123,
"proration_payment_id": "<string>"
}Migre um assinante para outra oferta recorrente (upgrade ou downgrade). O ciclo corrente fica intocado; o preço e a cadência novos valem a partir da próxima renovação, e a régua de preços re-congela na da oferta nova.
string
required
O
id (uuid) da assinatura.string
required
O
id (uuid) da oferta recorrente de destino (do mesmo lojista). A oferta carrega a régua de preços e o intervalo novos. Oferta inexistente ou de outro lojista devolve 404.string
default:"next_cycle"
Quando a troca vale:
next_cycle(padrão): o novo preço passa a valer na próxima renovação.immediate: prorateia agora. Upgrade cobra a diferença na hora; downgrade gera crédito abatido do próximo ciclo.
Resposta
string
immediate ou next_cycle.integer
A diferença prorateada, em centavos (positiva no upgrade, negativa no downgrade).
string
A próxima cobrança (a cadência nova só anda a partir dela).
integer
O valor do próximo ciclo, já no plano novo.
string
O pagamento do upgrade imediato, se houver.
Resposta 200
{
"message": "Plano trocado. A mudança vale a partir da próxima renovação.",
"data": {
"id": "1e24d112-3a6d-4d13-a3f7-9366a232d35a",
"plan_id": "a2b1...",
"effective": "next_cycle",
"delta": 0,
"next_charge_at": "2026-09-18",
"next_charge_amount": 9900,
"interval": "monthly"
}
}
O preview e a execução do valor prorateado batem no centavo. Se o adquirente recusar a cobrança imediata do upgrade, a resposta é 422 e o plano não troca.
Trocar
monthly → quarterly muda a cadência: a próxima renovação já cobra o novo preço, e a renovação seguinte anda três meses. O assinante nunca volta ao preço antigo depois da troca.