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

# Quickstart

> Do zero ao depósito pago, em modo test

Em **modo test** você integra o fluxo completo — inclusive recebendo o webhook assinado —
sem mover um centavo. Troque `pk_test_`/`sk_test_` por `pk_live_`/`sk_live_` para produção.

<Steps>
  <Step title="Crie um depósito">
    ```bash theme={null}
    curl -X POST https://api.swytchpay.app/v1/deposits \
      -H "x-api-key: pk_test_xxx" \
      -H "x-api-secret: sk_test_xxx" \
      -H "Content-Type: application/json" \
      -d '{
        "amount_cents": 10000,
        "external_id": "pedido-42",
        "payer": { "name": "Player Um", "email": "p1@ok.io", "phone": "+5511988887777", "document": "11144477735" }
      }'
    ```

    Resposta `201`: `{ "id": "dep_…", "status": "PENDING", "pix": { "emv": "000201…" }, "fee_cents": 350, "net_cents": 9650 }`.
    O `emv` é o copia-e-cola PIX que o player paga.
  </Step>

  <Step title="Registre seu webhook">
    ```bash theme={null}
    curl -X POST https://api.swytchpay.app/v1/webhooks \
      -H "x-api-key: pk_test_xxx" -H "x-api-secret: sk_test_xxx" \
      -H "Content-Type: application/json" \
      -d '{ "name": "minha corretora", "url": "https://suacorretora.com/webhooks/swytch" }'
    ```

    A resposta traz o `secret` (`whsec_…`) **uma única vez** — guarde para validar a assinatura.
  </Step>

  <Step title="Simule o pagamento (test)">
    ```bash theme={null}
    curl -X POST https://api.swytchpay.app/v1/test/deposits/dep_xxx/pay \
      -H "x-api-key: pk_test_xxx" -H "x-api-secret: sk_test_xxx"
    ```

    Isso roda o fluxo **real** (status → `PAID`, crédito no saldo) e dispara o webhook `deposit.paid`
    assinado para a sua URL.
  </Step>

  <Step title="Confira o saldo">
    ```bash theme={null}
    curl https://api.swytchpay.app/v1/balance \
      -H "x-api-key: pk_test_xxx" -H "x-api-secret: sk_test_xxx"
    # { "brl": { "available_cents": 9650, ... } }
    ```
  </Step>
</Steps>

Pronto: você criou, pagou e recebeu a confirmação assinada. Em produção, o `/test/.../pay` é
substituído pelo pagamento real do player (confirmado pelo provedor via webhook).
