Skip to main content
Permite ao cliente alterar o plano da sua assinatura informando um novo product_price_id.

Autenticação

Requer Customer Session Token no header Authorization: Bearer cst_xxx.

Requisição

id
string
required
ID da assinatura.
product_price_id
string
required
ID do novo preço/plano para o qual a assinatura será alterada.
cURL
curl -X PATCH https://api.chargefy.io/api/v1/customer-portal/subscriptions/sub_123 \
  -H "Authorization: Bearer cst_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "product_price_id": "price_new456"
  }'

Resposta

Resposta 200
{
  "id": "sub_123",
  "status": "active",
  "product": {
    "id": "prod_def",
    "name": "Plano Enterprise"
  },
  "price": {
    "id": "price_new456",
    "amount": 19900,
    "currency": "BRL",
    "recurring_interval": "month"
  },
  "current_period_start": "2025-07-01T00:00:00Z",
  "current_period_end": "2025-08-01T00:00:00Z",
  "cancel_at_period_end": false,
  "created_at": "2025-01-15T10:30:00Z",
  "updated_at": "2025-07-15T09:00:00Z"
}
A troca de plano é aplicada imediatamente. O valor é calculado proporcionalmente (pro-rata) ao período restante.