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

# Consultar cobranca PIX

> Consulta uma cobranca PIX por ID para sincronizar status e dados de pagamento.

## Caso de uso

Use esta rota para consultar o estado de uma cobranca ja criada e sincronizar seu ERP, checkout ou painel financeiro.

## Autenticacao

* `x-client-id`
* `x-client-secret`

## Pre-condicoes e requisitos

* O `id` deve ser um identificador da cobranca/transacao retornado pela Turbofy: `id`, `externalRef`, `providerChargeId`, `pixTxid` ou `endToEndId`.
* A cobranca precisa pertencer ao merchant autenticado.

## Request

Parametro principal:

* `id` (path): identificador da cobranca PIX ou da transacao Pix vinculada.

## Response de sucesso

Em `200`, a API retorna:

* `id`, `status`, `amountCents`, `description`
* `pix.qrCode`, `pix.copyPaste`, `pix.expiresAt`
* `payer`: pagador real da transacao com `name`, `email`, `phone`, `document`, `documentType`, `institution`, `agency` e `account` quando disponiveis
* `beneficiary`: merchant recebedor da cobranca; a conta aparece como conta TurbofyPay, como uma instituicao de pagamento
* `splits` (quando houver)
* `createdAt` e `updatedAt`

Exemplo parcial:

```json theme={null}
{
  "id": "3f8d6f3a-87f9-4ed4-a820-95f76f050fca",
  "status": "PAID",
  "amountCents": 2990,
  "payer": {
    "name": "Maria Pagadora",
    "email": "maria@example.com",
    "phone": "11999998888",
    "document": "39053344705",
    "documentType": "CPF",
    "institution": "Banco Origem",
    "agency": "0001",
    "account": "123456-7"
  },
  "beneficiary": {
    "id": "merchant-123",
    "name": "Loja Recebedora",
    "email": "loja@example.com",
    "document": "12345678000195",
    "documentType": "CNPJ",
    "institution": "TurbofyPay",
    "account": {
      "institution": "TurbofyPay",
      "type": "Conta de pagamento"
    }
  }
}
```

## Erros comuns reais

| HTTP  | code                   | Quando ocorre                                     |
| ----- | ---------------------- | ------------------------------------------------- |
| `400` | `MERCHANT_ID_REQUIRED` | Merchant nao resolvido na credencial.             |
| `401` | `CREDENTIALS_REQUIRED` | Credenciais ausentes.                             |
| `401` | `INVALID_CREDENTIALS`  | Credenciais invalidas.                            |
| `404` | `NOT_FOUND`            | Cobranca inexistente para o merchant autenticado. |

## Regras de negocio e observacoes operacionais

* A consulta retorna somente cobrancas do merchant autenticado.
* O pagador vem dos dados reais da transacao Pix quando o pagamento ja foi confirmado e ha `endToEndId` disponivel; se a rede Pix estiver indisponivel, a API usa snapshot persistido ou metadata local.
* O beneficiario e sempre o merchant dono da cobranca. A TurbofyPay aparece como instituicao/conta de pagamento, nao como beneficiario final.
* Para conciliacao, persista `id`, `status`, `externalRef` e timestamps.
* Alias legado `/rifeiro/pix/:id` existe por compatibilidade; use `/sellers/pix/{id}` como caminho principal.

## Exemplo de codigo

```bash theme={null}
curl --request GET \
  --url https://api.turbofypay.com/sellers/pix/3f8d6f3a-87f9-4ed4-a820-95f76f050fca \
  --header "x-client-id: <client-id>" \
  --header "x-client-secret: <client-secret>"
```

## Proximos passos

1. Se ainda nao criou a cobranca, use [Criar cobranca PIX](/reference/cobranca-pix/criar-cobranca-pix).
2. Para eventos assincronos, configure [Webhooks](/integracao/webhooks).


## OpenAPI

````yaml GET /sellers/pix/{id}
openapi: 3.0.3
info:
  title: Turbofy Public API
  version: 2.0.0
  description: >-
    Especificacao publica da API TurbofyPay para Cobranca PIX, Saques, Webhooks
    e Payouts.
  contact:
    name: Turbofy Team
    email: suporte@turbofy.com
    url: https://turbofy.com
  license:
    name: Proprietary
    url: https://turbofy.com/terms
servers:
  - url: http://localhost:3030
    description: Development Server
  - url: https://api.turbofypay.com
    description: Production Server
security: []
tags:
  - name: Cobranca PIX
    description: Operacoes de cobranca PIX para integradores.
  - name: Saques
    description: Operacoes de saque para sellers.
  - name: Webhooks
    description: Cadastro e consulta de webhooks.
  - name: Payouts
    description: Gestao de lotes de payout.
externalDocs:
  description: Documentação completa
  url: https://docs.turbofy.com
paths:
  /sellers/pix/{id}:
    get:
      tags:
        - Cobranca PIX
      summary: Consultar cobranca PIX
      description: Consulta o status e os dados de uma cobranca PIX pelo identificador.
      operationId: getPixCharge
      parameters:
        - schema:
            type: string
          in: path
          name: id
          required: true
          description: >-
            Identificador da cobranca/transacao: id, externalRef,
            providerChargeId, pixTxid ou endToEndId.
        - $ref: '#/components/parameters/XClientId'
        - $ref: '#/components/parameters/XClientSecret'
      responses:
        '200':
          description: Cobranca PIX encontrada.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PixChargeStatusResponse'
        '400':
          description: Merchant nao resolvido na credencial.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Credenciais ausentes ou invalidas.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Cobranca nao encontrada para o seller autenticado.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - clientCredentials: []
          clientSecret: []
components:
  parameters:
    XClientId:
      name: x-client-id
      in: header
      required: true
      schema:
        type: string
      description: Identificador do integrador.
    XClientSecret:
      name: x-client-secret
      in: header
      required: true
      schema:
        type: string
      description: Segredo de autenticacao do integrador.
  schemas:
    PixChargeStatusResponse:
      allOf:
        - $ref: '#/components/schemas/PixChargeObject'
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
            message:
              type: string
            details:
              type: object
              additionalProperties: true
            traceId:
              type: string
    PixChargeObject:
      type: object
      required:
        - id
        - status
        - amountCents
        - pix
        - createdAt
      properties:
        id:
          type: string
        status:
          type: string
        amountCents:
          type: integer
        description:
          type: string
          nullable: true
        pix:
          type: object
          required:
            - qrCode
            - copyPaste
            - expiresAt
          properties:
            qrCode:
              type: string
            copyPaste:
              type: string
            expiresAt:
              type: string
              format: date-time
        splits:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
              merchantId:
                type: string
              amountCents:
                type: integer
              percentage:
                type: number
                nullable: true
        webhook:
          type: object
          nullable: true
          properties:
            url:
              type: string
              format: uri
            secret:
              type: string
            events:
              type: array
              items:
                type: string
        payer:
          type: object
          nullable: true
          properties:
            name:
              type: string
              nullable: true
            email:
              type: string
              nullable: true
            phone:
              type: string
              nullable: true
            document:
              type: string
              nullable: true
            documentType:
              type: string
              enum:
                - CPF
                - CNPJ
              nullable: true
            institution:
              type: string
              nullable: true
            agency:
              type: string
              nullable: true
            account:
              type: string
              nullable: true
        beneficiary:
          type: object
          nullable: true
          properties:
            id:
              type: string
            name:
              type: string
            email:
              type: string
            document:
              type: string
              nullable: true
            documentType:
              type: string
              enum:
                - CPF
                - CNPJ
              nullable: true
            institution:
              type: string
            account:
              type: object
              properties:
                institution:
                  type: string
                type:
                  type: string
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
  securitySchemes:
    clientCredentials:
      type: apiKey
      in: header
      name: x-client-id
      description: Client ID fornecido pela TurbofyPay.
    clientSecret:
      type: apiKey
      in: header
      name: x-client-secret
      description: Client Secret fornecido pela TurbofyPay.

````