> ## Documentation Index
> Fetch the complete documentation index at: https://docs.autorizou.com.br/llms.txt
> Use this file to discover all available pages before exploring further.

# Criar Assinatura

> Crie assinaturas recorrentes com cobrança automática de clientes

Permite criar assinaturas recorrentes (semanal, mensal ou anual) com cobrança automática. Ideal para serviços SaaS, academias, escolas e outros modelos de negócio baseados em recorrência.

<Info>
  Há três jeitos de vender uma assinatura, todos no mesmo modelo:

  1. **Oferta recorrente com link pronto:** crie uma [oferta recorrente](/api-reference/products/create-offer) e compartilhe o `checkout_url` dela. O comprador informa os próprios dados e paga.
  2. **Link de pagamento recorrente:** crie um [link](/api-reference/payment-links/create-payment-link) com `recurrence_interval`. Mesma ideia, sem produto.
  3. **Headless (esta rota):** você já tem os dados do cliente e do cartão e cria a assinatura direto. Aponte uma oferta recorrente por `offer_id` para herdar a régua de preços, ou envie `interval` mais `amount` para uma recorrência simples.

  Não existe "plano avulso": a régua de preços vive na **oferta**.
</Info>

## Idempotência (obrigatória)

Esta rota **exige** o header `Idempotency-Key` — uma chave única gerada por assinatura (ex.: um UUID). **Sem ele, a resposta é `400`.**

```http theme={null}
Idempotency-Key: 550e8400-e29b-41d4-a716-446655440000
```

* **Replay:** a mesma chave com o mesmo corpo devolve a **resposta original** (não cria uma segunda assinatura) — seguro para retry.
* **Conflito (`409`):** a mesma chave com corpo diferente é rejeitada.
* **Em voo:** requisição concorrente com a mesma chave recebe **`409`** + header **`Retry-After`**.

## Parâmetros da Requisição

### Dados Básicos

<ParamField body="description" type="string" required>
  Descrição da assinatura (aparece na fatura)

  **Máximo:** 255 caracteres
</ParamField>

<ParamField body="code" type="string" required>
  Identificador único da assinatura no seu sistema

  **Máximo:** 255 caracteres
</ParamField>

<ParamField body="mcc" type="string" required>
  Código MCC (Merchant Category Code) do seu negócio

  **Exemplo:** `"5734"` (Software as a Service)
</ParamField>

<ParamField body="notification_url" type="string">
  URL para receber webhooks sobre eventos da assinatura

  **Formato:** URL válida
</ParamField>

### Oferta e Recorrência

<ParamField body="offer_id" type="string">
  UUID de uma **oferta recorrente** (criada em [Produtos e Ofertas](/api-reference/products/create-offer)). Quando fornecido, a assinatura **herda a régua de preços e o intervalo** da oferta, e você não precisa enviar `interval`. A régua **congela na assinatura** no momento em que ela nasce: editar a oferta depois nunca reprecifica quem já assina.
</ParamField>

<ParamField body="interval" type="string">
  Intervalo de cobrança (obrigatório se `offer_id` não fornecido)

  **Valores:** `weekly`, `monthly`, `yearly`
</ParamField>

<ParamField body="start_at" type="date">
  Data de início da assinatura

  **Formato:** `YYYY-MM-DD`

  **Padrão:** data atual
</ParamField>

<ParamField body="best_charge_day" type="integer">
  Melhor dia do mês para cobrança (1-31)

  **Padrão:** dia da criação
</ParamField>

<ParamField body="trial_days" type="integer">
  Dias de período de teste gratuito

  **Mínimo:** `0` | **Máximo:** `365`
</ParamField>

<ParamField body="next_charge_amount" type="integer" required>
  Valor da próxima cobrança em centavos

  **Importante:** Para PIX Recorrente, se não especificado, será usado o valor de `payment.pix_recurring.recurring_amount` ou `payment.amount`

  **Exemplo:** `4990` = R\$ 49,90
</ParamField>

### Cliente

<ParamField body="customer" type="object" required>
  <Expandable title="Dados do cliente">
    <ParamField body="customer.id" type="string">
      UUID do cliente cadastrado (ou crie um novo fornecendo os dados abaixo)
    </ParamField>

    <ParamField body="customer.name" type="string">
      Nome completo (obrigatório se criando cliente)

      **Máximo:** 64 caracteres
    </ParamField>

    <ParamField body="customer.email" type="string">
      Email válido (obrigatório se criando cliente)

      **Máximo:** 64 caracteres
    </ParamField>

    <ParamField body="customer.documents" type="array">
      Lista de documentos (obrigatório se criando cliente)

      <Expandable title="Documento">
        <ParamField body="customer.documents[].type" type="string">
          **Valores:** `cpf`, `cnpj`, `passport`, `rg`, `other`
        </ParamField>

        <ParamField body="customer.documents[].value" type="string">
          Número do documento
        </ParamField>
      </Expandable>
    </ParamField>

    <ParamField body="customer.phone" type="object">
      Telefone do cliente (opcional)

      <Expandable title="Dados do telefone">
        <ParamField body="customer.phone.type" type="string">
          **Valores:** `residential`, `mobile`, `commercial`, `public`
        </ParamField>

        <ParamField body="customer.phone.ddi" type="string">
          Código DDI (ex: `"55"`)
        </ParamField>

        <ParamField body="customer.phone.ddd" type="string">
          Código DDD (ex: `"11"`)
        </ParamField>

        <ParamField body="customer.phone.number" type="string">
          Número do telefone
        </ParamField>
      </Expandable>
    </ParamField>

    <ParamField body="customer.addresses" type="array">
      Endereços do cliente (opcional)

      <Expandable title="Dados do endereço">
        <ParamField body="customer.addresses[].type" type="string">
          **Valores:** `billing`, `shipping`
        </ParamField>

        <ParamField body="customer.addresses[].postal_code" type="string">
          CEP (apenas números)
        </ParamField>

        <ParamField body="customer.addresses[].line_1" type="string">
          Logradouro
        </ParamField>

        <ParamField body="customer.addresses[].line_2" type="string">
          Complemento
        </ParamField>

        <ParamField body="customer.addresses[].number" type="string">
          Número
        </ParamField>

        <ParamField body="customer.addresses[].neighborhood" type="string">
          Bairro
        </ParamField>

        <ParamField body="customer.addresses[].city" type="string">
          Cidade
        </ParamField>

        <ParamField body="customer.addresses[].state" type="string">
          Estado (sigla de 2 caracteres)
        </ParamField>

        <ParamField body="customer.addresses[].country" type="string">
          País (código ISO alpha-2, ex: `"BR"`)
        </ParamField>
      </Expandable>
    </ParamField>
  </Expandable>
</ParamField>

### Pagamento

<ParamField body="payment" type="object" required>
  <Expandable title="Configurações de pagamento">
    <ParamField body="payment.amount" type="integer">
      Valor da assinatura em centavos (obrigatório se não usar `offer_id`)

      **Exemplo:** `5000` = R\$ 50,00
    </ParamField>

    <ParamField body="payment.currency" type="string" required>
      Moeda do pagamento

      **Valor:** `BRL`
    </ParamField>

    <ParamField body="payment.payment_method" type="string" required>
      Método de pagamento

      **Valores:** `credit_card`, `pix`, `pix_recurring`, `bank_slip`, `google_pay`
    </ParamField>

    <ParamField body="payment.installments" type="integer" required>
      Número de parcelas (1-12)

      **Padrão:** `1`
    </ParamField>

    <ParamField body="payment.credit_card" type="object">
      Configurações do cartão de crédito (obrigatório se `payment_method = "credit_card"`)

      <Expandable title="Dados do cartão">
        <ParamField body="payment.credit_card.id" type="string" required>
          UUID do cartão salvo do cliente
        </ParamField>

        <ParamField body="payment.credit_card.statement_descriptor" type="string" required>
          Nome que aparecerá na fatura (máx 22 caracteres)
        </ParamField>

        <ParamField body="payment.credit_card.capture" type="boolean" required>
          Se deve capturar automaticamente

          **Padrão:** `true`
        </ParamField>

        <ParamField body="payment.credit_card.processing_model" type="string" required>
          Modelo de processamento

          **Valores:** `customer_initiated`, `merchant_initiated`, `merchant_initiated_subscription`
        </ParamField>
      </Expandable>
    </ParamField>

    <ParamField body="payment.bank_slip" type="object">
      Configurações do boleto (obrigatório se `payment_method = "bank_slip"`)

      <Expandable title="Dados do boleto">
        <ParamField body="payment.bank_slip.due_at" type="string" required>
          Data de vencimento (ISO 8601)

          **Exemplo:** `"2024-02-01T23:59:59Z"`
        </ParamField>
      </Expandable>
    </ParamField>

    <ParamField body="payment.pix" type="object">
      Configurações do PIX (obrigatório se `payment_method = "pix"`)

      <Expandable title="Dados do PIX">
        <ParamField body="payment.pix.expires_at" type="string" required>
          Data/hora de expiração (ISO 8601)

          **Exemplo:** `"2024-01-15T18:00:00Z"`
        </ParamField>
      </Expandable>
    </ParamField>

    <ParamField body="payment.pix_recurring" type="object">
      Configurações do PIX Recorrente (obrigatório se `payment_method = "pix_recurring"`)

      <Expandable title="Dados do PIX Recorrente">
        <ParamField body="payment.pix_recurring.recurring_statement" type="string" required>
          Descrição que aparecerá na fatura recorrente do cliente

          **Máximo:** 35 caracteres

          **Exemplo:** `"Assinatura Mensal - Meu App"`
        </ParamField>

        <ParamField body="payment.pix_recurring.recurring_amount" type="integer">
          Valor recorrente em centavos (se diferente do valor inicial)

          **Exemplo:** `9990` = R\$ 99,90
        </ParamField>

        <ParamField body="payment.pix_recurring.min_amount" type="integer">
          Valor mínimo aceito em centavos para pagamentos recorrentes

          **Exemplo:** `5000` = R\$ 50,00
        </ParamField>

        <ParamField body="payment.pix_recurring.retry_policy" type="boolean">
          Se deve tentar novamente em caso de falha

          **Padrão:** `true` | **Máximo de tentativas:** 3
        </ParamField>
      </Expandable>
    </ParamField>

    <ParamField body="payment.google_pay" type="object">
      Configurações do Google Pay (obrigatório se `payment_method = "google_pay"`)

      <Expandable title="Dados do Google Pay">
        <ParamField body="payment.google_pay.google_pay_token" type="string" required>
          Token do Google Pay
        </ParamField>

        <ParamField body="payment.google_pay.statement_descriptor" type="string" required>
          Nome na fatura (máx 22 caracteres)
        </ParamField>

        <ParamField body="payment.google_pay.capture" type="boolean" required>
          Se deve capturar automaticamente
        </ParamField>

        <ParamField body="payment.google_pay.capture_delay_hours" type="integer">
          Horas para aguardar captura (se capture = false)
        </ParamField>
      </Expandable>
    </ParamField>

    <ParamField body="payment.split" type="array">
      Divisão do pagamento entre destinatários (opcional)

      <Expandable title="Configuração do split">
        <ParamField body="payment.split[].recipient_id" type="integer" required>
          ID do destinatário cadastrado
        </ParamField>

        <ParamField body="payment.split[].amount" type="integer" required>
          Valor em centavos para este destinatário
        </ParamField>

        <ParamField body="payment.split[].type" type="string" required>
          Tipo do split

          **Valores:** `flat`, `percentage`
        </ParamField>

        <ParamField body="payment.split[].allow_charge_processing_fee" type="boolean" required>
          Se este destinatário paga taxas de processamento
        </ParamField>

        <ParamField body="payment.split[].allow_charge_remainder_fee" type="boolean" required>
          Se este destinatário paga taxas restantes
        </ParamField>

        <ParamField body="payment.split[].is_liable" type="boolean" required>
          Se este destinatário é responsável por chargebacks
        </ParamField>
      </Expandable>
    </ParamField>
  </Expandable>
</ParamField>

### Itens (Opcional)

<ParamField body="items" type="array">
  Lista de itens da assinatura (opcional, para controle interno)

  <Expandable title="Dados do item">
    <ParamField body="items[].name" type="string">
      Nome do item (máx 64 caracteres)
    </ParamField>

    <ParamField body="items[].description" type="string">
      Descrição do item (máx 256 caracteres)
    </ParamField>

    <ParamField body="items[].quantity" type="integer">
      Quantidade (mínimo 1)
    </ParamField>

    <ParamField body="items[].amount" type="integer">
      Valor unitário em centavos
    </ParamField>
  </Expandable>
</ParamField>

## Exemplos de Requisição

<CodeGroup>
  ```bash cURL - Assinatura Mensal theme={null}
  curl -X POST https://pay.autorizou.dev/api/v1/charges/subscriptions \
    -H "Authorization: Bearer 4eC39HqLyjWDarjtT1zdp7dc" \
    -H "Content-Type: application/json" \
    -d '{
      "description": "Assinatura Mensal Premium",
      "code": "SUB_PREMIUM_001",
      "mcc": "5734",
      "interval": "monthly",
      "best_charge_day": 10,
      "trial_days": 7,
      "customer": {
        "id": "550e8400-e29b-41d4-a716-446655440000"
      },
      "payment": {
        "amount": 9990,
        "currency": "BRL",
        "payment_method": "credit_card",
        "installments": 1,
        "credit_card": {
          "id": "3f7d2a91-8c4e-4b6f-9a2d-5e8c1f4b7a30",
          "statement_descriptor": "MINHAEMPRESA PREMIUM",
          "capture": true,
          "processing_model": "merchant_initiated_subscription"
        }
      }
    }'
  ```

  ```bash cURL - Headless por oferta (offer_id) theme={null}
  # A assinatura herda a régua de preços e o intervalo da oferta recorrente.
  # Não envie interval nem amount: eles vêm da oferta.
  curl -X POST https://pay.autorizou.dev/api/v1/charges/subscriptions \
    -H "Authorization: Bearer 4eC39HqLyjWDarjtT1zdp7dc" \
    -H "Content-Type: application/json" \
    -H "Idempotency-Key: 550e8400-e29b-41d4-a716-446655440000" \
    -d '{
      "description": "Clube Órbita - Mensal",
      "code": "SUB_ORBITA_001",
      "mcc": "5734",
      "offer_id": "b9af7796-ac98-47f2-b921-46b0415d7473",
      "best_charge_day": 10,
      "customer": {
        "id": "550e8400-e29b-41d4-a716-446655440000"
      },
      "payment": {
        "currency": "BRL",
        "payment_method": "credit_card",
        "installments": 1,
        "credit_card": {
          "id": "3f7d2a91-8c4e-4b6f-9a2d-5e8c1f4b7a30",
          "statement_descriptor": "CLUBE ORBITA",
          "capture": true,
          "processing_model": "merchant_initiated_subscription"
        }
      }
    }'
  ```

  ```bash cURL - Assinatura com Novo Cliente theme={null}
  curl -X POST https://pay.autorizou.dev/api/v1/charges/subscriptions \
    -H "Authorization: Bearer 4eC39HqLyjWDarjtT1zdp7dc" \
    -H "Content-Type: application/json" \
    -d '{
      "description": "Assinatura Anual Básica",
      "code": "SUB_BASIC_2024",
      "mcc": "5734",
      "interval": "yearly",
      "customer": {
        "name": "Maria Silva",
        "email": "maria@exemplo.com.br",
        "documents": [
          {
            "type": "cpf",
            "value": "12345678901"
          }
        ],
        "phone": {
          "type": "mobile",
          "ddi": "55",
          "ddd": "11",
          "number": "987654321"
        }
      },
      "payment": {
        "amount": 99900,
        "currency": "BRL",
        "payment_method": "credit_card",
        "installments": 1,
        "credit_card": {
          "id": "b96e2d54-7a3c-4f8e-91d6-4e7a2c5f8b19",
          "statement_descriptor": "MEUAPP ANUAL",
          "capture": true,
          "processing_model": "merchant_initiated_subscription"
        }
      }
    }'
  ```

  ```bash cURL - Assinatura com PIX Recorrente theme={null}
  curl -X POST https://pay.autorizou.dev/api/v1/charges/subscriptions \
    -H "Authorization: Bearer 4eC39HqLyjWDarjtT1zdp7dc" \
    -H "Content-Type: application/json" \
    -d '{
      "description": "Assinatura Mensal Premium PIX",
      "code": "SUB_PIX_REC_001",
      "mcc": "5734",
      "interval": "monthly",
      "best_charge_day": 10,
      "trial_days": 0,
      "next_charge_amount": 4990,
      "customer": {
        "id": "550e8400-e29b-41d4-a716-446655440000"
      },
      "payment": {
        "amount": 4990,
        "currency": "BRL",
        "payment_method": "pix_recurring",
        "installments": 1,
        "pix_recurring": {
          "recurring_statement": "Assinatura Premium - MeuApp",
          "recurring_amount": 4990,
          "min_amount": 2000,
          "retry_policy": true
        }
      }
    }'
  ```
</CodeGroup>

## Resposta

<ResponseField name="id" type="string">
  UUID único da assinatura
</ResponseField>

<ResponseField name="hash" type="string">
  Hash único da assinatura
</ResponseField>

<ResponseField name="state" type="string">
  O momento da assinatura, para você decidir o acesso do cliente.

  **Valores:** `trial`, `pending`, `active`, `past_due`, `unpaid`, `canceled`, `ended`, `completed`. Ver [Ciclo de vida e estados](/api-reference/subscriptions/lifecycle).
</ResponseField>

<ResponseField name="has_access" type="boolean">
  **Libere o seu serviço por aqui.** `true` quando o cliente deve ter acesso. Não recalcule a partir do `state`.
</ResponseField>

<ResponseField name="interval" type="string">
  Intervalo de cobrança: `weekly`, `monthly`, `yearly`
</ResponseField>

<ResponseField name="next_charge_amount" type="integer">
  Valor da próxima cobrança em centavos
</ResponseField>

<ResponseField name="installments" type="integer">
  Número de parcelas
</ResponseField>

<ResponseField name="next_charge_at" type="string">
  Data/hora da próxima cobrança (formato: `DD/MM/YYYY HH:mm:ss`)
</ResponseField>

<ResponseField name="start_at" type="string">
  Data de início da assinatura
</ResponseField>

<ResponseField name="end_at" type="string">
  Data de término (se aplicável)
</ResponseField>

<ResponseField name="trial_days" type="integer">
  Dias de período de teste
</ResponseField>

<ResponseField name="current_cycle" type="integer">
  Ciclo atual da assinatura
</ResponseField>

<ResponseField name="payment" type="object">
  <Expandable title="Dados do pagamento inicial">
    <ResponseField name="payment.id" type="string">
      UUID do pagamento
    </ResponseField>

    <ResponseField name="payment.hash" type="string">
      Hash do pagamento
    </ResponseField>

    <ResponseField name="payment.status" type="string">
      Status do pagamento
    </ResponseField>

    <ResponseField name="payment.payment_method" type="string">
      Método de pagamento usado
    </ResponseField>

    <ResponseField name="payment.amount" type="integer">
      Valor em centavos
    </ResponseField>

    <ResponseField name="payment.installments" type="integer">
      Número de parcelas
    </ResponseField>

    <ResponseField name="payment.currency" type="string">
      Moeda
    </ResponseField>

    <ResponseField name="payment.description" type="string">
      Descrição
    </ResponseField>

    <ResponseField name="payment.credit_card" type="object">
      Dados do cartão (quando aplicável)
    </ResponseField>

    <ResponseField name="payment.pix" type="object">
      Dados do PIX (quando aplicável)
    </ResponseField>

    <ResponseField name="payment.pix_recurring" type="object">
      Dados do PIX Recorrente (quando aplicável)

      <Expandable title="Estrutura do PIX Recorrente">
        <ResponseField name="payment.pix_recurring.qr_code" type="string">
          Código QR Code para o primeiro pagamento
        </ResponseField>

        <ResponseField name="payment.pix_recurring.qr_code_url" type="string">
          URL do QR Code em formato imagem
        </ResponseField>

        <ResponseField name="payment.pix_recurring.charge_code" type="string">
          Código de autorização recorrente para cobranças futuras
        </ResponseField>

        <ResponseField name="payment.pix_recurring.recurring_statement" type="string">
          Descrição exibida na fatura recorrente
        </ResponseField>

        <ResponseField name="payment.pix_recurring.expires_at" type="string">
          Data/hora de expiração do QR Code inicial
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="payment.bank_slip" type="object">
      Dados do boleto (quando aplicável)
    </ResponseField>

    <ResponseField name="payment.created_at" type="string">
      Data de criação
    </ResponseField>

    <ResponseField name="payment.updated_at" type="string">
      Data de atualização
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="fee" type="object">
  <Expandable title="Taxas aplicadas">
    <ResponseField name="fee.fixed_fee_amount" type="integer">
      Valor da taxa fixa em centavos
    </ResponseField>

    <ResponseField name="fee.platform_fee_percentage" type="number">
      Percentual da taxa da plataforma
    </ResponseField>

    <ResponseField name="fee.platform_fee_amount" type="integer">
      Valor da taxa da plataforma em centavos
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="customer" type="object">
  <Expandable title="Dados do cliente">
    <ResponseField name="customer.id" type="string">
      UUID do cliente
    </ResponseField>

    <ResponseField name="customer.name" type="string">
      Nome do cliente
    </ResponseField>

    <ResponseField name="customer.email" type="string">
      Email do cliente
    </ResponseField>
  </Expandable>
</ResponseField>

### Exemplo de Resposta

```json 201 Created theme={null}
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "hash": "AUTSCC01JZX3Y5T4Q8KWVREGH2M9SR",
  "status": "payment_approved",
  "interval": "monthly",
  "next_charge_amount": 9990,
  "installments": 1,
  "next_charge_at": "10/02/2024 10:00:00",
  "start_at": "10/01/2024",
  "end_at": null,
  "trial_days": 7,
  "current_cycle": 1,
  "payment": {
    "id": "a52c8e17-6b4d-4f9a-83e2-7d5b1c8f4a26",
    "hash": "AUTPCC01JZX3Y5T4Q8KWVREGH2M9SS",
    "merchant_reference": "SUB_PREMIUM_001",
    "status": "authorized",
    "payment_method": "credit_card",
    "amount": 9990,
    "installments": 1,
    "currency": "BRL",
    "description": "Assinatura Mensal Premium",
    "metadata": null,
    "credit_card": {
      "id": "3f7d2a91-8c4e-4b6f-9a2d-5e8c1f4b7a30",
      "holder": "MARIA SILVA",
      "brand": "visa",
      "first_6": "424242",
      "last_4": "4242",
      "exp_month": "12",
      "exp_year": "30",
      "statement_descriptor": "ASSINATURA PREMIUM",
      "capture": true,
      "three_ds": null
    },
    "created_at": "10/01/2024 10:00:00",
    "updated_at": "10/01/2024 10:00:05"
  },
  "fee": {
    "fixed_fee_amount": 39,
    "platform_fee_percentage": 3.99,
    "platform_fee_amount": 399
  },
  "customer": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "Maria Silva",
    "email": "maria@exemplo.com.br"
  }
}
```

## Códigos de Status

<ResponseExample>
  ```json 422 - Validation Error theme={null}
  {
    "message": "Os dados fornecidos são inválidos",
    "errors": {
      "payment.amount": ["O campo amount é obrigatório quando offer_id não é fornecido"],
      "offer_id": ["Oferta recorrente não encontrada."],
      "customer.id": ["Cliente não encontrado"],
      "payment.credit_card.id": ["Cartão não encontrado ou não pertence ao cliente"]
    }
  }
  ```

  ```json 201 - Cobrança recusada (não é erro HTTP) theme={null}
  {
    "status": "payment_refused",
    "payment": {
      "status": "refused",
      "refused_reason": "Não autorizado",
      "return_code": "05"
    }
  }
  ```
</ResponseExample>

## PIX Recorrente - Como Funciona

O PIX Recorrente permite cobranças automáticas recorrentes usando o PIX como método de pagamento, sem a necessidade de cartão de crédito.

### Fluxo de Pagamento

1. **Primeiro Pagamento (Autorização)**
   * Cliente escaneia QR Code e realiza o primeiro pagamento via PIX
   * Esse pagamento autoriza cobranças futuras automáticas
   * Um `charge_code` único é gerado para identificar a autorização recorrente

2. **Cobranças Recorrentes Automáticas**
   * O sistema agenda automaticamente os pagamentos futuros
   * Pagamentos são processados 2-10 dias antes da data de vencimento.
   * Cliente é notificado antes de cada cobrança

3. **Política de Retry (Tentativas)**
   * Em caso de falha, o sistema tenta novamente automaticamente
   * Até 3 tentativas com intervalo de 1 dia entre cada
   * Tentativas ocorrem em até 7 dias da data original

### Status do Ciclo de Vida do Pagamento PIX Recorrente

<Note>
  Os status de pagamento do PIX Recorrente seguem um fluxo específico diferente dos outros métodos.
</Note>

| Status            | Descrição                                                      | Quando Ocorre                              |
| ----------------- | -------------------------------------------------------------- | ------------------------------------------ |
| `waiting_payment` | Aguardando o primeiro pagamento PIX                            | Após criação da assinatura, QR Code gerado |
| `scheduled`       | Pagamento agendado para processamento                          | 3 dias antes da data de cobrança           |
| `processing`      | Pagamento sendo processado                                     | 2 dias antes da data de cobrança           |
| `authorized`      | Pagamento autorizado com sucesso                               | Após confirmação do pagamento              |
| `refused`         | Pagamento recusado (saldo insuficiente, limite excedido, etc.) | Quando a cobrança falha                    |
| `expired`         | QR Code ou cobrança expirou                                    | Após período de expiração sem pagamento    |
| `settled`         | Pagamento liquidado                                            | Após processamento final e transferência   |

### Transições de Status Permitidas

**PIX Recorrente - Primeiro Pagamento:**

```
waiting_payment → authorized (pagamento confirmado)
waiting_payment → scheduled (para PIX recorrente, quando inicia ciclo)
waiting_payment → expired (QR code expirou)
```

**PIX Recorrente - Cobranças Automáticas:**

```
scheduled → processing (enviado para processadora)
scheduled → authorized (cobrança aprovada)
scheduled → refused (cobrança recusada)
scheduled → error (erro no processamento)

refused → scheduled (retry automático, se retry_policy = true)
```

### Regras Importantes

<Warning>
  **Janela de Processamento:** Pagamentos PIX Recorrentes devem ser enviados entre 2 e 10 dias antes da data de vencimento.
</Warning>

* **Valor Mínimo:** Defina `min_amount` para evitar cobranças abaixo de um valor específico
* **Período de Trial:** Pode ser usado com `trial_days > 0`, mas o primeiro pagamento deve ser `amount = 0`
* **Política de Retry:** Com `retry_policy = true`, até 3 tentativas automáticas em caso de falha
* **Charge Code:** Obrigatório e único por assinatura, usado para identificar a autorização recorrente

### Exemplo de Resposta com PIX Recorrente

```json 201 Created theme={null}
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "hash": "SUB_pixrec123xyz",
  "status": "waiting_payment",
  "interval": "monthly",
  "next_charge_amount": 4990,
  "installments": 1,
  "next_charge_at": "10/02/2024 10:00:00",
  "start_at": "10/01/2024",
  "trial_days": 0,
  "current_cycle": 1,
  "payment": {
    "id": "b52e8c94-7d1a-4e6f-93b8-5a2d7e4c1f68",
    "hash": "PAY_pixrec789ghi",
    "merchant_reference": "SUB_PIX_REC_001",
    "status": "waiting_payment",
    "payment_method": "pix_recurring",
    "amount": 4990,
    "installments": 1,
    "currency": "BRL",
    "description": "Assinatura Mensal Premium PIX",
    "pix_recurring": {
      "qr_code": "00020126580014br.gov.bcb.pix...",
      "qr_code_url": "https://api.autorizou.dev/qr/pixrec456def.png",
      "charge_code": "CHG_REC_abc123xyz789",
      "recurring_statement": "Assinatura Premium - MeuApp",
      "expires_at": "2024-01-15T23:59:59Z"
    },
    "created_at": "10/01/2024 10:00:00",
    "updated_at": "10/01/2024 10:00:00"
  },
  "customer": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "João Silva",
    "email": "joao@exemplo.com.br"
  }
}
```

## Próximos Passos

Após criar uma assinatura:

1. [Cancelar assinatura](/api-reference/subscriptions/cancel-subscription) quando necessário
2. [Consultar pagamentos](/api-reference/charges/payments/get-payment) da assinatura
3. Configurar webhooks para acompanhar eventos de cobrança recorrente
4. Para PIX Recorrente: exibir QR Code ao cliente e aguardar primeiro pagamento
