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

# Criar pagamento

> Cria um novo pagamento (Pix, Cartão de crédito ou Boleto).

## Erro de validação

Se o body falhar no DTO, a API responde HTTP `400`.

`message` fica `Dados inválidos`. `code` fica `VALIDATION_ERROR`. `details` lista as mensagens do DTO.

```json theme={null}
{
  "statusCode": 400,
  "code": "VALIDATION_ERROR",
  "message": "Dados inválidos",
  "error": "Bad Request",
  "details": ["card.number must be a valid card number"]
}
```

Outros `400` desta rota não trazem `code` nem `details`.


## OpenAPI

````yaml POST /v1/payments
openapi: 3.0.0
info:
  title: UvviPay Public API
  description: >-
    Endpoints públicos da plataforma UvviPay para integração de subcontas
    (submerchants).
  version: 1.0.0
  contact: {}
servers:
  - url: https://api.uvvipay.com.br
    description: Produção
  - url: https://api-staging.uvvipay.com.br
    description: Staging
security:
  - client-id: []
    client-secret: []
tags: []
paths:
  /v1/payments:
    post:
      tags:
        - Pagamentos
      summary: Criar pagamento
      description: Cria um novo pagamento (Pix, Cartão de crédito ou Boleto).
      operationId: createPayment
      parameters:
        - name: client-secret
          in: header
          description: Secret da credencial do merchant
          required: true
          schema:
            type: string
        - name: client-id
          in: header
          description: ID público da credencial do merchant
          required: true
          schema:
            type: string
        - name: x-idempotency-key
          in: header
          description: >-
            Chave de idempotência opcional (até 255 caracteres, ex.: UUID v4)
            gerada pelo cliente. Reenviar a mesma chave com o mesmo payload
            retorna a transação já criada, sem nova cobrança. Use para retry
            seguro após timeout.
          required: false
          schema:
            type: string
            maxLength: 255
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePaymentDto'
            examples:
              Cartão de crédito:
                summary: Cartão de crédito aberto (number, cvv, holderName e validade)
                value:
                  externalId: 35d29135-f14e-4695-b9ae-ccde91676a60
                  amount: 9900
                  paymentMethod: credit_card
                  card:
                    number: '4111111111111111'
                    holderName: JOAO DA SILVA
                    cvv: '123'
                    expirationMonth: 12
                    expirationYear: 2030
                    installments: 1
                  customer:
                    name: João da Silva
                    email: joao@example.com
                    document:
                      number: '12345678901'
                      type: cpf
                  items:
                    - title: Curso completo
                      quantity: 1
                      unitPrice: 9900
              creditCardVault:
                summary: Cartão do Cofre
                value:
                  externalId: 7c9e6679-7425-40de-944b-e07fc1f90ae7
                  amount: 9900
                  paymentMethod: credit_card
                  card:
                    cardTokenId: 550e8400-e29b-41d4-a716-446655440000
                    installments: 1
                  items:
                    - title: Curso completo
                      quantity: 1
                      unitPrice: 9900
              creditCardUpsellToken:
                summary: Upsell com card.upsellToken (sem cartão, sem customer)
                value:
                  externalId: 9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d
                  amount: 2990
                  paymentMethod: credit_card
                  card:
                    upsellToken: AbCdEfGhIjKlMnOpQrStUv
                    installments: 3
                  items:
                    - title: Mentoria
                      quantity: 1
                      unitPrice: 2990
              pixDefaultExpiration:
                summary: PIX com validade padrão (30 min)
                value:
                  externalId: 3fccc92f-17c1-4f3c-8923-fcd1f41c5e48
                  amount: 7500
                  paymentMethod: pix
                  customer:
                    name: João da Silva
                    email: joao@example.com
                    document:
                      number: '12345678901'
                      type: cpf
                  items:
                    - title: Produto
                      quantity: 1
                      unitPrice: 7500
              pixCustomExpirationSeconds:
                summary: PIX com validade em segundos (1h)
                value:
                  externalId: 3fccc92f-17c1-4f3c-8923-fcd1f41c5e48
                  amount: 7500
                  paymentMethod: pix
                  customer:
                    name: João da Silva
                    email: joao@example.com
                    document:
                      number: '12345678901'
                      type: cpf
                  items:
                    - title: Produto
                      quantity: 1
                      unitPrice: 7500
                  pix:
                    expiration:
                      type: seconds
                      value: 3600
              pixCustomExpirationDate:
                summary: PIX com validade em data ISO 8601
                value:
                  externalId: 3fccc92f-17c1-4f3c-8923-fcd1f41c5e48
                  amount: 7500
                  paymentMethod: pix
                  customer:
                    name: João da Silva
                    email: joao@example.com
                    document:
                      number: '12345678901'
                      type: cpf
                  items:
                    - title: Produto
                      quantity: 1
                      unitPrice: 7500
                  pix:
                    expiration:
                      type: date
                      value: <ISO8601_FUTURE_DATETIME>
              boletoDefaultExpiration:
                summary: Boleto com vencimento padrão (30 dias)
                value:
                  externalId: 3fccc92f-17c1-4f3c-8923-fcd1f41c5e48
                  amount: 7500
                  paymentMethod: boleto
                  customer:
                    name: Maria Silva
                    email: maria@example.com
                    document:
                      number: '12345678901'
                      type: cpf
                    address:
                      street: Avenida Paulista
                      streetNumber: '1000'
                      zipCode: '01310100'
                      neighborhood: Bela Vista
                      city: Sao Paulo
                      state: SP
                      country: BR
                  items:
                    - title: Produto
                      quantity: 1
                      unitPrice: 7500
              boletoCustomExpiration:
                summary: Boleto com vencimento ISO 8601 (máx. 30 dias)
                value:
                  externalId: 3fccc92f-17c1-4f3c-8923-fcd1f41c5e48
                  amount: 7500
                  paymentMethod: boleto
                  customer:
                    name: Maria Silva
                    email: maria@example.com
                    document:
                      number: '12345678901'
                      type: cpf
                    address:
                      street: Avenida Paulista
                      streetNumber: '1000'
                      zipCode: '01310100'
                      neighborhood: Bela Vista
                      city: Sao Paulo
                      state: SP
                      country: BR
                  items:
                    - title: Produto
                      quantity: 1
                      unitPrice: 7500
                  boleto:
                    expirationDate: '2026-09-09T18:00:00.000Z'
      responses:
        '200':
          description: >-
            Pagamento criado (ou recuperado por idempotência quando
            x-idempotency-key é reenviada). Em cartão aberto aprovado, inclui
            `upsell.token` válido por 15 minutos para cobrar uma oferta
            adicional via `card.upsellToken`; ver guia Upsell com um clique.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentResponseDto'
              examples:
                Cartão de crédito pago:
                  summary: Cartão aprovado (card.brand e card.last4)
                  value:
                    id: 547c8482-47d8-4692-a48d-54ea35384c6e
                    status: paid
                    amount: 9900
                    paymentMethod: credit_card
                    card:
                      brand: visa
                      last4: '1111'
                    externalReference: 35d29135-f14e-4695-b9ae-ccde91676a60
                    customer:
                      name: João da Silva
                      email: joao@example.com
                      phone: null
                      documentNumber: '12345678901'
                      documentType: cpf
                      address:
                        zipCode: null
                        street: null
                        streetNumber: null
                        neighborhood: null
                        city: null
                        state: null
                        country: null
                    items:
                      - title: Curso completo
                        quantity: 1
                        unitPrice: 9900
                    createdAt: '2026-09-14T18:51:12.947Z'
                creditCardRefused:
                  summary: Cartão recusado (card + refusedReason)
                  value:
                    id: 547c8482-47d8-4692-a48d-54ea35384c6e
                    status: refused
                    amount: 9900
                    paymentMethod: credit_card
                    card:
                      brand: mastercard
                      last4: '4444'
                    refusedReason:
                      category: issuer_declined
                      description: Recusa do banco emissor
                    externalReference: 35d29135-f14e-4695-b9ae-ccde91676a60
                    customer:
                      name: João da Silva
                      email: joao@example.com
                      phone: null
                      documentNumber: '12345678901'
                      documentType: cpf
                      address:
                        zipCode: null
                        street: null
                        streetNumber: null
                        neighborhood: null
                        city: null
                        state: null
                        country: null
                    items:
                      - title: Curso completo
                        quantity: 1
                        unitPrice: 9900
                    createdAt: '2026-09-14T18:51:12.947Z'
                creditCardApplePay:
                  summary: Apple Pay (card.wallet.type apple_pay)
                  value:
                    id: 6ba7b810-9dad-11d1-80b4-00c04fd430c8
                    status: paid
                    amount: 9900
                    paymentMethod: credit_card
                    card:
                      brand: visa
                      last4: '4242'
                      wallet:
                        type: apple_pay
                    externalReference: 3fa85f64-5717-4562-b3fc-2c963f66afa6
                    createdAt: '2026-09-14T18:51:12.947Z'
                creditCardPaidWithUpsell:
                  summary: Cartão aberto aprovado com upsell.token
                  value:
                    id: a1b2c3d4-0000-4000-8000-000000000001
                    status: paid
                    amount: 9900
                    paymentMethod: credit_card
                    card:
                      brand: visa
                      last4: '1111'
                    externalReference: 35d29135-f14e-4695-b9ae-ccde91676a60
                    upsell:
                      token: AbCdEfGhIjKlMnOpQrStUv
                      expiresAt: '2026-09-14T19:06:12.947Z'
                    createdAt: '2026-09-14T18:51:12.947Z'
                upsellCharged:
                  summary: Upsell cobrado via card.upsellToken
                  value:
                    id: a1b2c3d4-0000-4000-8000-000000000002
                    status: paid
                    amount: 2990
                    paymentMethod: credit_card
                    card:
                      brand: visa
                      last4: '1111'
                    externalReference: 9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d
                    createdAt: '2026-09-14T18:52:30.000Z'
        '400':
          description: >-
            Falha de DTO (`VALIDATION_ERROR` + `details`), 400 genérico sem
            `code`/`details`, ou 400 do controlador
            (`IDEMPOTENCY_KEY_NOT_SUPPORTED`, `UPSELL_TOKEN_NOT_SUPPORTED`).
            Também cobre `pix.expiration` ou `boleto.expirationDate` fora das
            regras, ou `customer.address` ausente em boleto.
          content:
            application/json:
              schema:
                oneOf:
                  - title: Falha de DTO
                    type: object
                    additionalProperties: false
                    required:
                      - statusCode
                      - code
                      - message
                      - error
                      - details
                    properties:
                      statusCode:
                        type: integer
                        example: 400
                      code:
                        type: string
                        enum:
                          - VALIDATION_ERROR
                      message:
                        type: string
                        example: Dados inválidos
                      error:
                        type: string
                        example: Bad Request
                      details:
                        type: array
                        items:
                          type: string
                        example:
                          - card.number must be a valid card number
                  - title: 400 genérico
                    type: object
                    additionalProperties: false
                    required:
                      - statusCode
                      - message
                      - error
                    properties:
                      statusCode:
                        type: integer
                        example: 400
                      message:
                        type: string
                        example: Dados inválidos
                      error:
                        type: string
                        example: Bad Request
                  - title: 400 do controlador
                    type: object
                    additionalProperties: false
                    required:
                      - code
                      - message
                    properties:
                      code:
                        type: string
                        enum:
                          - IDEMPOTENCY_KEY_NOT_SUPPORTED
                          - UPSELL_TOKEN_NOT_SUPPORTED
                      message:
                        type: string
        '401':
          description: Credenciais inválidas ou ausentes
        '404':
          description: >-
            cardTokenId não encontrado, inativo ou não pertencente à sua conta;
            ou upsellToken inexistente, revogado ou de outra conta (code
            UPSELL_TOKEN_NOT_FOUND)
        '409':
          description: >-
            Já existe um pagamento em processamento ou unknown com esta
            x-idempotency-key (code PAYMENT_IN_PROGRESS); upsellToken já
            utilizado ou em uso concorrente (code UPSELL_TOKEN_USED); pagamento
            de origem do upsell não está mais pago (code UPSELL_ORIGIN_NOT_PAID)
        '410':
          description: >-
            upsellToken expirado, prazo de 15 minutos encerrado (code
            UPSELL_TOKEN_EXPIRED)
        '422':
          description: >-
            Pagamento recusado, validade Pix acima do limite operacional da
            adquirente, ou x-idempotency-key reutilizada com payload diferente
            (code IDEMPOTENCY_PAYLOAD_MISMATCH)
        '500':
          description: Erro interno
components:
  schemas:
    CreatePaymentDto:
      type: object
      properties:
        externalId:
          type: string
          description: Identificador único do pedido no sistema do merchant
          example: 35d29135-f14e-4695-b9ae-ccde91676a60
        amount:
          type: number
          description: Valor total em centavos (mínimo 100, máximo 15000000)
          minimum: 100
          maximum: 15000000
          example: 7500
        paymentMethod:
          type: string
          enum:
            - pix
            - credit_card
            - boleto
          example: credit_card
        customer:
          $ref: '#/components/schemas/PaymentCustomerDto'
        items:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/PaymentItemDto'
        subMerchant:
          allOf:
            - $ref: '#/components/schemas/PaymentSubMerchantDto'
          description: >-
            Subconta owner da transação (opcional). Quando informada, é
            identificada pelo documento (CPF/CNPJ) de uma subconta já cadastrada
            e ativa e passa a ser a owner do split; sem este objeto, o próprio
            merchant é o owner.
        split:
          type: array
          minItems: 1
          description: >-
            Regras de divisão do valor líquido entre subcontas recebedoras.
            Requer os produtos PaaS e Split habilitados para o merchant; o owner
            é o próprio merchant, salvo se um subMerchant for informado. Os
            valores resolvidos retornam no campo split da resposta. Ver guia
            Pagamentos com Split.
          items:
            $ref: '#/components/schemas/PaymentSplitRuleDto'
        card:
          $ref: '#/components/schemas/PaymentCardDto'
        applePay:
          allOf:
            - $ref: '#/components/schemas/ApplePayDto'
          description: >-
            Pagamento via Apple Pay, alternativa ao bloco card (envie um ou
            outro, nunca ambos). Válido apenas com paymentMethod credit_card; o
            criptograma do token dispensa CVV e 3DS. Ver guia Apple Pay.
        threeDSData:
          $ref: '#/components/schemas/ThreeDSDataDto'
        ip:
          type: string
          description: >-
            IP do cliente. A API exige este campo. Envie IPv4 ou IPv6, sem porta
            e sem colchetes. Texto vazio conta como ausente.
          example: 192.0.2.1
        invoiceDescriptor:
          type: string
          example: LOJA EXEMPLO
        fingerprint:
          type: string
        metaData:
          type: object
          additionalProperties: true
          example:
            order_id: '123'
        pix:
          type: object
          description: >-
            Opções de Pix. Use `expiration` para definir a validade do QR por
            cobrança. Se omitido, o padrão é 30 minutos (1800 segundos).
          properties:
            expiration:
              description: Validade customizável do QR Pix
              oneOf:
                - type: object
                  required:
                    - type
                    - value
                  properties:
                    type:
                      type: string
                      enum:
                        - seconds
                      description: '`seconds` = `value` em segundos (900 a 7776000).'
                    value:
                      type: number
                      minimum: 900
                      maximum: 7776000
                      example: 3600
                      description: Segundos até a expiração (quando type=seconds)
                - type: object
                  required:
                    - type
                    - value
                  properties:
                    type:
                      type: string
                      enum:
                        - date
                      description: '`date` = `value` em ISO 8601 futura, no máximo 90 dias.'
                    value:
                      type: string
                      format: date-time
                      example: <ISO8601_FUTURE_DATETIME>
                      description: >-
                        Instante ISO 8601 de expiração (quando type=date).
                        Aceita Z, ±HH:MM ou ±HHMM (ex.:
                        2026-08-12T14:59:47.565-0300). Mín. 15 minutos e máx. 90
                        dias no futuro.
        boleto:
          type: object
          description: >-
            Opções de boleto. Use `expirationDate` para definir o vencimento. Se
            omitido, o padrão é 30 dias. Válido apenas com `paymentMethod`
            boleto. Ver guia Boleto.
          properties:
            expirationDate:
              type: string
              pattern: >-
                ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?(?:Z|[+-]\d{2}:\d{2}|[+-]\d{4})$
              example: '2026-09-09T18:00:00.000Z'
              description: >-
                Vencimento ISO 8601 no futuro, no máximo 30 dias. Aceita Z,
                ±HH:MM ou ±HHMM (ex.: 2026-09-09T15:00:00.000-0300).
      required:
        - externalId
        - amount
        - paymentMethod
        - items
        - ip
      oneOf:
        - title: PIX ou cartão com customer
          required:
            - customer
          properties:
            paymentMethod:
              type: string
              enum:
                - pix
                - credit_card
          not:
            anyOf:
              - type: object
                required:
                  - card
                properties:
                  card:
                    type: object
                    required:
                      - cardTokenId
              - required:
                  - boleto
        - title: Cartão do Cofre
          required:
            - card
            - paymentMethod
          properties:
            paymentMethod:
              type: string
              enum:
                - credit_card
            card:
              type: object
              required:
                - cardTokenId
          not:
            anyOf:
              - required:
                  - customer
              - required:
                  - threeDSData
              - required:
                  - boleto
        - title: Boleto
          required:
            - customer
            - paymentMethod
          properties:
            paymentMethod:
              type: string
              enum:
                - boleto
            boleto:
              type: object
              description: >-
                Opções de boleto. Use `expirationDate` para definir o
                vencimento. Se omitido, o padrão é 30 dias. Válido apenas com
                `paymentMethod` boleto. Ver guia Boleto.
              properties:
                expirationDate:
                  type: string
                  pattern: >-
                    ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?(?:Z|[+-]\d{2}:\d{2}|[+-]\d{4})$
                  example: '2026-09-09T18:00:00.000Z'
                  description: >-
                    Vencimento ISO 8601 no futuro, no máximo 30 dias. Aceita Z,
                    ±HH:MM ou ±HHMM (ex.: 2026-09-09T15:00:00.000-0300).
      not:
        required:
          - card
          - applePay
        description: >-
          card e applePay são mutuamente exclusivos; envie um ou outro, nunca
          ambos
    PaymentResponseDto:
      type: object
      properties:
        id:
          type: string
          format: uuid
          example: d398b016-3c29-41b4-afc0-bbf8c81c683c
        status:
          type: string
          enum:
            - waiting_payment
            - paid
            - refused
            - refunded
            - in_analysis
          example: paid
        amount:
          type: number
          example: 15680
        paymentMethod:
          type: string
          example: credit_card
        transactionId:
          type: string
        card:
          $ref: '#/components/schemas/PaymentCardResponseDto'
        pix:
          $ref: '#/components/schemas/PixResponseDto'
        boleto:
          $ref: '#/components/schemas/BoletoResponseDto'
        refusedReason:
          $ref: '#/components/schemas/RefusedReasonDto'
        subMerchant:
          $ref: '#/components/schemas/PaymentSubMerchantResponseDto'
        split:
          type: array
          description: >-
            Split resolvido da transação: valor efetivamente destinado a cada
            recebedor, em centavos (quando a transação possui split)
          items:
            $ref: '#/components/schemas/PaymentSplitRuleResponseDto'
        customer:
          $ref: '#/components/schemas/PaymentCustomerResponseDto'
        items:
          type: array
          items:
            $ref: '#/components/schemas/PaymentItemResponseDto'
        externalReference:
          type: string
          example: 35d29135-f14e-4695-b9ae-ccde91676a60
        upsell:
          $ref: '#/components/schemas/PaymentUpsellResponseDto'
        createdAt:
          type: string
          format: date-time
          example: '2026-07-02T19:41:46.738Z'
      required:
        - id
        - status
        - amount
        - paymentMethod
        - createdAt
    PaymentCustomerDto:
      type: object
      properties:
        name:
          type: string
          example: João da Silva
          maxLength: 255
        email:
          type: string
          format: email
          example: joao@exemplo.com
          maxLength: 320
        phone:
          type: string
          example: '11987654321'
          maxLength: 20
        document:
          $ref: '#/components/schemas/PaymentDocumentDto'
        address:
          allOf:
            - $ref: '#/components/schemas/PaymentAddressDto'
          description: Endereço do customer. Obrigatório quando `paymentMethod` é `boleto`.
        externalRef:
          type: string
          example: CUSTOMER-123
      required:
        - name
        - email
        - document
    PaymentItemDto:
      type: object
      properties:
        title:
          type: string
          example: Produto X
        quantity:
          type: number
          minimum: 1
          example: 1
        unitPrice:
          type: number
          minimum: 0
          example: 7500
        tangible:
          type: boolean
          example: true
      required:
        - title
        - quantity
        - unitPrice
    PaymentSubMerchantDto:
      type: object
      description: >-
        Subconta owner da transação. Obrigatório quando split é enviado: é dela
        que sai o valor líquido distribuído aos recebedores.
      properties:
        id:
          type: string
          description: Identificador da subconta no sistema do integrador
          example: SUB-001
        legalName:
          type: string
          description: Razão social da subconta
          example: Loja Exemplo LTDA
        document:
          $ref: '#/components/schemas/PaymentDocumentDto'
        mcc:
          type: string
          description: Merchant Category Code da subconta
          example: '5732'
        url:
          type: string
          description: Site da subconta
          example: https://lojaexemplo.com.br
        phone:
          type: string
          description: Telefone da subconta
          example: '11999998888'
        address:
          $ref: '#/components/schemas/PaymentAddressDto'
        invoiceDescriptor:
          type: string
          description: Descritor exibido na fatura do portador
          example: LOJA EXEMPLO
      required:
        - id
        - legalName
        - document
        - mcc
        - url
        - phone
        - address
    PaymentSplitRuleDto:
      type: object
      description: >-
        Regra de divisão do valor líquido da transação para uma subconta
        recebedora.
      properties:
        recipientId:
          type: string
          format: uuid
          description: ID (UUID) da subconta recebedora, retornado na criação da subconta
          example: 5b9f3d6a-3a2c-4d6f-9b9e-0a1b2c3d4e5f
        type:
          type: string
          enum:
            - percentage
            - flat
          description: >-
            percentage: percentual sobre o líquido (1 a 100). flat: valor fixo
            inteiro em centavos
          example: percentage
        amount:
          type: number
          minimum: 1
          description: >-
            Percentual (1 a 100) quando type=percentage, ou valor inteiro em
            centavos quando type=flat
          example: 30
      required:
        - recipientId
        - type
        - amount
    PaymentCardDto:
      description: >-
        Dados do cartão. Três modos: cartão aberto (number, cvv, holderName,
        expirationMonth, expirationYear obrigatórios; customer obrigatório no
        body; quando aprovado, a resposta traz `upsell.token`), cartão do Cofre
        (cardTokenId, sem PAN/CVV e sem customer no body) ou token de upsell
        (upsellToken emitido por um pagamento anterior aprovado, sem PAN/CVV,
        sem customer e sem threeDSData). Não misture os modos na mesma
        requisição.
      oneOf:
        - title: Cartão aberto
          type: object
          required:
            - number
            - cvv
            - holderName
            - expirationMonth
            - expirationYear
          additionalProperties: false
          properties:
            number:
              type: string
              example: '4111111111111111'
            holderName:
              type: string
              example: JOAO DA SILVA
            cvv:
              type: string
              example: '123'
            expirationMonth:
              type: number
              minimum: 1
              maximum: 12
              example: 12
            expirationYear:
              type: number
              example: 2029
            installments:
              type: number
              minimum: 1
              maximum: 24
              example: 1
            deviceId:
              type: string
              example: device_abc123
            brand:
              type: string
              example: visa
        - title: Cartão do Cofre
          type: object
          required:
            - cardTokenId
          additionalProperties: false
          properties:
            cardTokenId:
              type: string
              format: uuid
              description: >-
                cardTokenId retornado por POST /v1/vault/tokenize. Quando
                presente, a cobrança usa o cartão do Cofre (sem PAN/CVV). Exige
                o produto tokenization e token pertencente à sua conta.
              example: 550e8400-e29b-41d4-a716-446655440000
            installments:
              type: number
              minimum: 1
              maximum: 24
              example: 1
            deviceId:
              type: string
              example: device_abc123
            brand:
              type: string
              example: visa
        - title: Token de upsell
          type: object
          required:
            - upsellToken
          additionalProperties: false
          properties:
            upsellToken:
              type: string
              pattern: ^[A-Za-z0-9_-]{22}$
              description: >-
                Token de upsell retornado em `upsell.token` por um pagamento
                anterior com cartão aberto e status `paid`. Uso único, válido
                por 15 minutos, vinculado ao pagamento de origem. Consumido em
                qualquer resposta da adquirente (aprovada ou recusada). Não
                envie customer nem threeDSData; amount, items, externalId,
                installments, description, metaData, subMerchant e split são
                livres.
              example: AbCdEfGhIjKlMnOpQrStUv
            installments:
              type: number
              minimum: 1
              maximum: 24
              example: 1
            deviceId:
              type: string
              example: device_abc123
    ApplePayDto:
      type: object
      properties:
        paymentData:
          type: string
          description: >-
            Base64 do PKPaymentToken.paymentData, exatamente como sai do
            PassKit/Apple Pay JS
          example: eyJ2ZXJzaW9uIjoiRUNfdjEiLCJkYXRhIjoiLi4uIn0=
        network:
          type: string
          description: >-
            Bandeira informada pela Apple em paymentMethod.network (ex.: Visa,
            MasterCard)
          example: Visa
        installments:
          type: integer
          minimum: 1
          maximum: 24
          default: 1
          description: Número de parcelas
      required:
        - paymentData
        - network
    ThreeDSDataDto:
      type: object
      description: Dados do resultado 3DS para cobrança autenticada com cartão de crédito
      properties:
        cavv:
          type: string
          description: Cardholder Authentication Verification Value
        eci:
          type: string
          description: Electronic Commerce Indicator
          example: '05'
        xid:
          type: string
        tdsver:
          type: string
          example: 2.2.0
        tdsdsxid:
          type: string
        directoryServerTransactionId:
          type: string
        ucaf:
          type: string
        paresStatus:
          type: string
        veresEnrolled:
          type: string
        authenticationResult:
          type: string
        returnCode:
          type: string
        returnMessage:
          type: string
        version:
          type: string
        type:
          type: string
          enum:
            - frictionless
            - challenge
    PaymentCardResponseDto:
      type: object
      description: >-
        Presente em pagamentos `credit_card` quando brand e last4 estão
        persistidos. Omitido em pix, boleto e wallet. Não inclui PAN, CVV,
        titular, validade nem BIN. Em Apple Pay inclui `wallet.type`.
      properties:
        brand:
          type: string
          description: Bandeira em minúsculo
          example: visa
        last4:
          type: string
          description: Últimos 4 dígitos do PAN ou DPAN (Apple Pay)
          example: '1111'
        wallet:
          $ref: '#/components/schemas/PaymentCardWalletResponseDto'
      required:
        - brand
        - last4
      example:
        brand: visa
        last4: '1111'
    PixResponseDto:
      type: object
      properties:
        qrcode:
          type: string
          description: >-
            Payload PIX (copia e cola / QR Code). Também retornado na cobrança
            de boleto.
        expiresAt:
          type: string
          format: date-time
          description: Data/hora em que o QR Code PIX expira (ISO 8601)
          example: '2026-08-12T17:36:05.917Z'
        expireIn:
          type: integer
          description: Duracao configurada do QR em segundos
          example: 1800
    BoletoResponseDto:
      type: object
      properties:
        digitableLine:
          type: string
          description: Linha digitável do boleto
          example: 34191.79001 01043.510047 91020.150008 1 98760000012345
      required:
        - digitableLine
    RefusedReasonDto:
      type: object
      description: >-
        Motivo da recusa (presente apenas quando status = refused). Consulte o
        guia [Recusas de cartão](/recusas-de-cartao) para entender as categorias
        e como orientar o cliente.
      properties:
        category:
          type: string
          description: >-
            Categoria abstraída do motivo da recusa. Presente em POST e GET. Não
            retorna código da adquirente.
          enum:
            - issuer_declined
            - invalid_card_data
            - temporary_unavailable
            - suspected_fraud
            - installments_exceeded
          example: issuer_declined
        description:
          type: string
          description: Rótulo amigável da categoria, pronto para exibição.
          example: Recusa do banco emissor
      required:
        - category
        - description
    PaymentSubMerchantResponseDto:
      type: object
      description: Dados públicos do submerchant (owner) vinculado à transação.
      properties:
        internalId:
          type: string
          format: uuid
          example: 550e8400-e29b-41d4-a716-446655440000
        legalName:
          type: string
          description: Razão social / nome do titular do submerchant
          example: Loja do João LTDA
        documentType:
          type: string
          enum:
            - cpf
            - cnpj
          example: cnpj
        documentNumber:
          type: string
          example: '12345678000199'
    PaymentSplitRuleResponseDto:
      type: object
      description: Valor do split efetivamente destinado a um recebedor.
      properties:
        recipient_id:
          type: string
          format: uuid
          description: Identificador público (UUID) do recebedor do split
          example: 5b9f3d6a-3a2c-4d6f-9b9e-0a1b2c3d4e5f
        amount:
          type: number
          description: Valor creditado ao recebedor, em centavos
          example: 2500
      required:
        - recipient_id
        - amount
    PaymentCustomerResponseDto:
      type: object
      description: Dados completos do cliente (presente quando disponível).
      properties:
        name:
          type: string
          example: João da Silva
        email:
          type: string
          example: joao@exemplo.com
        phone:
          type: string
          example: '11987654321'
        documentNumber:
          type: string
          example: '12345678901'
        documentType:
          type: string
          enum:
            - cpf
            - cnpj
            - passport
          example: cpf
        address:
          $ref: '#/components/schemas/PaymentCustomerAddressResponseDto'
    PaymentItemResponseDto:
      type: object
      description: Item da transação, retornado exatamente como salvo na criação.
      properties:
        title:
          type: string
          example: Produto X
        quantity:
          type: number
          example: 1
        tangible:
          type: boolean
          example: true
        unitPrice:
          type: number
          example: 15680
    PaymentUpsellResponseDto:
      type: object
      description: >-
        Presente apenas em pagamentos com cartão aberto (number/cvv) aprovados
        (`status: paid`) cuja emissão do token teve sucesso. Não é emitido para
        cobranças via cardTokenId ou upsellToken. A emissão é best-effort: a
        ausência do objeto não indica falha do pagamento.
      properties:
        token:
          type: string
          description: >-
            Token opaco de uso único para enviar em `card.upsellToken` em um
            novo POST /v1/payments.
          example: AbCdEfGhIjKlMnOpQrStUv
        expiresAt:
          type: string
          format: date-time
          description: Instante em que o token expira (15 minutos após a emissão).
          example: '2026-07-02T19:56:46.738Z'
      required:
        - token
        - expiresAt
    PaymentDocumentDto:
      type: object
      properties:
        number:
          type: string
          example: '12345678901'
          maxLength: 50
        type:
          type: string
          enum:
            - cpf
            - cnpj
          example: cpf
      required:
        - number
        - type
    PaymentAddressDto:
      type: object
      properties:
        zipCode:
          type: string
          example: '01310100'
          maxLength: 20
        street:
          type: string
          example: Avenida Paulista
          maxLength: 255
        streetNumber:
          type: string
          example: '1000'
          maxLength: 50
        complement:
          type: string
          example: Conjunto 101
        neighborhood:
          type: string
          example: Bela Vista
          maxLength: 100
        city:
          type: string
          example: São Paulo
          maxLength: 100
        state:
          type: string
          example: SP
          maxLength: 21
        country:
          type: string
          example: BR
          maxLength: 2
      required:
        - zipCode
        - street
        - streetNumber
        - neighborhood
        - city
        - state
        - country
    PaymentCardWalletResponseDto:
      type: object
      description: >-
        Presente apenas quando o pagamento credit_card foi autorizado via wallet
        (Apple Pay).
      properties:
        type:
          type: string
          enum:
            - apple_pay
          example: apple_pay
      required:
        - type
    PaymentCustomerAddressResponseDto:
      type: object
      properties:
        zipCode:
          type: string
          example: '01310100'
        street:
          type: string
          example: Avenida Paulista
        streetNumber:
          type: string
          example: '1000'
        neighborhood:
          type: string
          example: Bela Vista
        city:
          type: string
          example: São Paulo
        state:
          type: string
          example: SP
        country:
          type: string
          example: BR
  securitySchemes:
    client-id:
      type: apiKey
      in: header
      name: client-id
    client-secret:
      type: apiKey
      in: header
      name: client-secret

````

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