> ## Documentation Index
> Fetch the complete documentation index at: https://scaleup-c34c4386.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Atualizar Assinatura

> Atualiza uma assinatura do cliente, como troca de plano.

Permite ao cliente alterar o plano da sua assinatura informando um novo `product_price_id`.

## Autenticação

> [!NOTE]
>
> 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.

```bash cURL theme={null}
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

```json Resposta 200 theme={null}
{
  "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"
}
```

> [!NOTE]
>
> A troca de plano é aplicada imediatamente. O valor é calculado proporcionalmente (pro-rata) ao período restante.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.