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

# Criar cobrança da subconta

> Exige subaccounts:read e payment_intents:write. UUID da MingoPay, organização e ambiente isolados. Idempotency-Key de 16 a 128 caracteres. Comissão e tarifa são registradas na criação.



## OpenAPI

````yaml /openapi.json post /v1/subaccounts/{id}/payment-intents
openapi: 3.1.0
info:
  title: MingoPay API
  version: 1.0.0
  description: >-
    API pública para cobranças Pix, subcontas, devoluções e consulta de saldo.
    Valores monetários em centavos; ambientes e saldos são isolados.
servers:
  - url: https://api.mingopay.com.br
    description: API MingoPay
security:
  - bearerAuth: []
tags:
  - name: Cobranças
    description: Criação, consulta e reconciliação de cobranças Pix.
  - name: Devoluções
    description: Devoluções parciais ou totais de cobranças pagas.
  - name: Saldo
    description: Saldo disponível calculado pelo ledger da organização.
  - name: Sandbox
    description: Simulações disponíveis somente para chaves mp_test_.
  - name: Subcontas
    description: >-
      Subcontas administradas pela sua organização, com cobranças e saldos
      separados.
paths:
  /v1/subaccounts/{id}/payment-intents:
    post:
      tags:
        - Subcontas
      summary: Criar cobrança da subconta
      description: >-
        Exige subaccounts:read e payment_intents:write. UUID da MingoPay,
        organização e ambiente isolados. Idempotency-Key de 16 a 128 caracteres.
        Comissão e tarifa são registradas na criação.
      operationId: createSubaccountPaymentIntent
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: Idempotency-Key
          in: header
          required: true
          schema:
            type: string
            minLength: 16
            maxLength: 128
            pattern: ^[A-Za-z0-9._-]+$
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required:
                - amountCents
                - method
                - payer
              properties:
                externalReference:
                  type: string
                  minLength: 1
                  maxLength: 100
                amountCents:
                  type: integer
                  minimum: 100
                  maximum: 100000000
                  description: Valor em centavos.
                method:
                  type: string
                  const: pix
                description:
                  type: string
                  minLength: 1
                  maxLength: 140
                expiresInSeconds:
                  type: integer
                  minimum: 60
                  maximum: 86400
                  default: 1800
                payer:
                  $ref: '#/components/schemas/Payer'
                metadata:
                  type: object
                  additionalProperties: true
                  default: {}
            example:
              externalReference: pedido_1024
              amountCents: 14990
              method: pix
              description: Pedido 1024
              expiresInSeconds: 1800
              payer:
                name: Cliente Exemplo
                taxId: '52998224725'
                email: cliente@example.com
              metadata:
                orderId: '1024'
      responses:
        '201':
          description: Cobrança criada.
          headers:
            idempotent-replayed:
              description: Presente com valor true quando a resposta foi reproduzida.
              schema:
                type: string
                const: 'true'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreatedPaymentIntent'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
components:
  schemas:
    Payer:
      type: object
      additionalProperties: false
      required:
        - name
        - taxId
      properties:
        name:
          type: string
          minLength: 2
          maxLength: 120
          description: >-
            Nome visível do pagador. Não aceita HTML, caracteres de controle nem
            marcas de direção invisíveis.
        taxId:
          type: string
          description: CPF ou CNPJ válido. Pontuação é removida pela API.
          examples:
            - '52998224725'
        email:
          type: string
          format: email
          maxLength: 254
          description: >-
            E-mail permanente. Domínios descartáveis, typos de Gmail, Outlook,
            Hotmail, Yahoo e iCloud, e domínios sem entrega são recusados.
    CreatedPaymentIntent:
      allOf:
        - $ref: '#/components/schemas/PaymentIntent'
        - type: object
          required:
            - pix
          properties:
            pix:
              $ref: '#/components/schemas/PixInstructions'
    PaymentIntent:
      type: object
      required:
        - id
        - organizationId
        - amountCents
        - feeCents
        - netCents
        - currency
        - method
        - status
        - metadata
        - createdAt
        - updatedAt
        - environment
        - providerFeeCents
        - platformFeeCents
        - commissionCents
        - mingoFeeCents
      properties:
        id:
          type: string
          format: uuid
        organizationId:
          type: string
          format: uuid
        customerId:
          type:
            - string
            - 'null'
          format: uuid
        externalReference:
          type:
            - string
            - 'null'
        amountCents:
          type: integer
        feeCents:
          type: integer
          description: 'Total descontado: mingoFeeCents + commissionCents.'
        netCents:
          type: integer
        currency:
          type: string
          const: BRL
        method:
          type: string
          enum:
            - pix
            - card
        status:
          $ref: '#/components/schemas/PaymentIntentStatus'
        provider:
          type:
            - string
            - 'null'
        providerReference:
          type:
            - string
            - 'null'
        description:
          type:
            - string
            - 'null'
        metadata:
          type: object
          additionalProperties: true
        expiresAt:
          type:
            - string
            - 'null'
          format: date-time
        paidAt:
          type:
            - string
            - 'null'
          format: date-time
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        subaccountId:
          type:
            - string
            - 'null'
          format: uuid
        environment:
          type: string
          enum:
            - sandbox
            - production
        providerFeeCents:
          type: integer
        platformFeeCents:
          type: integer
          description: >-
            Receita Mingo: mingoFeeCents - providerFeeCents, sem a comissão do
            criador.
        commissionCents:
          type: integer
          minimum: 0
          description: Comissão do criador da subconta, incluída em feeCents.
        mingoFeeCents:
          type: integer
          minimum: 0
          description: Tarifa Mingo, incluindo o custo do provedor.
    PixInstructions:
      type: object
      required:
        - copyPasteCode
        - expiresAt
      properties:
        copyPasteCode:
          type: string
        expiresAt:
          type: string
          format: date-time
    ApiError:
      type: object
      required:
        - error
        - message
        - requestId
      properties:
        error:
          type: string
        message:
          type: string
        requestId:
          type: string
        details:
          type: array
          items:
            type: object
            required:
              - path
              - message
            properties:
              path:
                type: string
              message:
                type: string
    PaymentIntentStatus:
      type: string
      enum:
        - created
        - pending
        - processing
        - paid
        - failed
        - cancelled
        - partially_refunded
        - refunded
  responses:
    BadRequest:
      description: Requisição inválida.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Unauthorized:
      description: Chave ausente ou inválida.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Forbidden:
      description: >-
        Ambiente, organização ou escopo não autorizado. Organizações suspensas
        (restricted) ou encerradas (closed) retornam organization_not_active em
        sandbox e produção.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Conflict:
      description: Conflito de estado ou idempotência.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    UnprocessableEntity:
      description: Operação válida, mas incompatível com os valores ou o estado atual.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    RateLimited:
      description: Limite de requisições excedido.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    ServiceUnavailable:
      description: Provedor ou operação temporariamente indisponível.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Chave de API MingoPay com prefixo mp_test_ ou mp_live_.

````

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