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

# Criar cobrança

> Cria uma nova transação de pagamento. Aceita o header opcional `Idempotency-Key` para repetição segura — a resposta 2xx original é replayada por 1 hora (com o header `x-idempotent-replayed`); requisição em voo com a mesma chave retorna 409; reusar a chave com body diferente retorna 422.



## OpenAPI

````yaml POST /api/v1/transactions/
openapi: 3.0.3
info:
  title: Bob Payments API
  description: >-
    API de pagamentos Bob Payments para criar, acompanhar e conciliar transações
    com PIX e cartão de crédito.
  version: 1.0.0
servers:
  - url: https://api.payments.bob.company
    description: Servidor de produção
security: []
paths:
  /api/v1/transactions/:
    post:
      summary: Criar nova transação
      description: >-
        Cria uma nova transação de pagamento. Aceita o header opcional
        `Idempotency-Key` para repetição segura — a resposta 2xx original é
        replayada por 1 hora (com o header `x-idempotent-replayed`); requisição
        em voo com a mesma chave retorna 409; reusar a chave com body diferente
        retorna 422.
      parameters:
        - name: Idempotency-Key
          in: header
          required: false
          description: >-
            Identificador único da operação (até 256 caracteres, ex. UUID ou ID
            do pedido). Torna a criação segura de repetir em timeout ou falha de
            rede, sem risco de pagamento duplicado.
          schema:
            type: string
            maxLength: 256
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                customer:
                  type: object
                  properties:
                    name:
                      type: string
                      minLength: 1
                      maxLength: 255
                    document:
                      type: string
                      minLength: 11
                      maxLength: 14
                    documentType:
                      type: string
                      enum:
                        - CPF
                        - CNPJ
                    email:
                      type: string
                      format: email
                      pattern: >-
                        ^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$
                    phone:
                      type: string
                      minLength: 10
                      maxLength: 15
                    address:
                      type: object
                      properties:
                        street:
                          type: string
                          minLength: 1
                          maxLength: 255
                        streetNumber:
                          type: string
                          minLength: 1
                          maxLength: 20
                        complement:
                          type: string
                          maxLength: 100
                        neighborhood:
                          type: string
                          minLength: 1
                          maxLength: 100
                        zipCode:
                          type: string
                          minLength: 8
                          maxLength: 9
                        city:
                          type: string
                          minLength: 1
                          maxLength: 100
                        state:
                          type: string
                          minLength: 2
                          maxLength: 2
                        country:
                          default: BR
                          type: string
                          minLength: 2
                          maxLength: 2
                      required:
                        - street
                        - streetNumber
                        - neighborhood
                        - zipCode
                        - city
                        - state
                  required:
                    - name
                    - document
                    - documentType
                    - email
                    - phone
                    - address
                payment:
                  type: object
                  properties:
                    amountCents:
                      type: integer
                      minimum: 1
                      maximum: 50000000
                    product:
                      type: string
                      minLength: 1
                      maxLength: 255
                    quantity:
                      default: 1
                      type: integer
                      minimum: 1
                      maximum: 9007199254740991
                    expirationDays:
                      type: integer
                      minimum: 1
                      maximum: 30
                  required:
                    - amountCents
                    - product
                originDomain:
                  description: >-
                    Domínio da loja/site que originou a transação (ex:
                    loja.exemplo.com.br). Obrigatório para rastreio de múltiplas
                    lojas. Use apenas o hostname, sem protocolo ou caminho.
                  type: string
                  minLength: 1
                  maxLength: 253
                customerIp:
                  description: >-
                    IP do usuário final que originou a requisição (IPv4 ou
                    IPv6). Quando informado, é usado para detecção de fraude e
                    bloqueio de IPs.
                  anyOf:
                    - type: string
                      format: ipv4
                      pattern: >-
                        ^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$
                    - type: string
                      format: ipv6
                      pattern: >-
                        ^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$
              required:
                - customer
                - payment
                - originDomain
      responses:
        '201':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    default: true
                    type: boolean
                  message:
                    type: string
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                      pixCode:
                        type: string
                      expirationDate:
                        type: string
                      status:
                        type: string
                    required:
                      - id
                      - status
                    additionalProperties: false
                required:
                  - success
                  - data
                additionalProperties: false
        '400':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                  title:
                    type: string
                  status:
                    type: integer
                    minimum: 400
                    maximum: 599
                  detail:
                    type: string
                  instance:
                    type: string
                  details:
                    type: object
                    additionalProperties: {}
                required:
                  - type
                  - title
                  - status
                  - detail
                  - instance
                additionalProperties: false
        '401':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                  title:
                    type: string
                  status:
                    type: integer
                    minimum: 400
                    maximum: 599
                  detail:
                    type: string
                  instance:
                    type: string
                  details:
                    type: object
                    additionalProperties: {}
                required:
                  - type
                  - title
                  - status
                  - detail
                  - instance
                additionalProperties: false
        '403':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                  title:
                    type: string
                  status:
                    type: integer
                    minimum: 400
                    maximum: 599
                  detail:
                    type: string
                  instance:
                    type: string
                  details:
                    type: object
                    additionalProperties: {}
                required:
                  - type
                  - title
                  - status
                  - detail
                  - instance
                additionalProperties: false
        '404':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                  title:
                    type: string
                  status:
                    type: integer
                    minimum: 400
                    maximum: 599
                  detail:
                    type: string
                  instance:
                    type: string
                  details:
                    type: object
                    additionalProperties: {}
                required:
                  - type
                  - title
                  - status
                  - detail
                  - instance
                additionalProperties: false
        '429':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                  title:
                    type: string
                  status:
                    type: integer
                    minimum: 400
                    maximum: 599
                  detail:
                    type: string
                  instance:
                    type: string
                  details:
                    type: object
                    additionalProperties: {}
                required:
                  - type
                  - title
                  - status
                  - detail
                  - instance
                additionalProperties: false
        '500':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                  title:
                    type: string
                  status:
                    type: integer
                    minimum: 400
                    maximum: 599
                  detail:
                    type: string
                  instance:
                    type: string
                  details:
                    type: object
                    additionalProperties: {}
                required:
                  - type
                  - title
                  - status
                  - detail
                  - instance
                additionalProperties: false
        '503':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                  title:
                    type: string
                  status:
                    type: integer
                    minimum: 400
                    maximum: 599
                  detail:
                    type: string
                  instance:
                    type: string
                  details:
                    type: object
                    properties:
                      retryAfterSeconds:
                        type: integer
                        description: >-
                          Tempo recomendado de espera (em segundos) antes de
                          tentar novamente
                        example: 30
                required:
                  - type
                  - title
                  - status
                  - detail
                  - instance
                additionalProperties: false
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        Autenticação por API Key usando token SK (sk_live_xxx ou sk_test_xxx).
        Envie como: Authorization: Bearer sk_live_xxx

````