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

# Criar transação

> Cria uma transação (cartão de crédito, Pix ou boleto).



## OpenAPI

````yaml /api-reference/openapi.yaml post /transactions
openapi: 3.0.3
info:
  title: API Beehive Pay
  version: 1.0.0
  description: >
    API pública da Beehive Pay para criar e gerenciar transações, clientes,
    reembolsos,

    transferências, recebedores, contas bancárias, saldo, empresa, Payment
    Links.


    Autenticação:

    - Basic Authorization (ex.: "Basic base64(SECRET_KEY:x)")

    - ou x-api-key (se habilitado no seu gateway)
servers:
  - url: https://api.conta.paybeehive.com.br/v1
    description: Produção
security:
  - basicAuth: []
  - apiKeyAuth: []
tags:
  - name: transactions
    x-group: Transações
    description: Criação e consulta de transações (cartão, Pix e boleto).
  - name: refunds
    x-group: Reembolsos
    description: Estornos/reembolsos de transações.
  - name: customers
    x-group: Clientes
    description: Criação e consulta de clientes.
  - name: transfers
    x-group: Transferências
    description: Criação e consulta de transferências.
  - name: balance
    x-group: Saldo
    description: Consulta de saldo.
  - name: recipients
    x-group: Recebedores
    description: Criação e consulta de recebedores.
  - name: bank-accounts
    x-group: Contas Bancárias
    description: Adição e consulta de contas bancárias.
  - name: company
    x-group: Empresa
    description: Dados e atualização de dados da empresa.
  - name: payment-links
    x-group: Links de Pagamento
    description: Criação e atualização de payment links.
  - name: webhooks
    x-group: Webhooks
    description: Modelo de payloads de eventos enviados via webhook/postback.
paths:
  /transactions:
    post:
      tags:
        - transactions
      summary: Criar transação
      description: Cria uma transação (cartão de crédito, Pix ou boleto).
      operationId: createTransaction
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TransactionCreateRequest'
      responses:
        '200':
          description: Transação criada
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Transaction'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    TransactionCreateRequest:
      type: object
      required:
        - amount
        - paymentMethod
        - customer
        - items
        - metadata
      properties:
        amount:
          type: integer
          description: Valor em centavos (500 = R$ 5,00)
          example: 500
        paymentMethod:
          type: string
          description: Forma de pagamento
          enum:
            - credit_card
            - boleto
            - pix
          example: credit_card
        card:
          $ref: '#/components/schemas/Card'
          description: Obrigatório quando paymentMethod = credit_card
        installments:
          type: integer
          description: Número de parcelas. Obrigatório quando paymentMethod = credit_card
          example: 1
        pix:
          $ref: '#/components/schemas/Pix'
          description: Obrigatório quando paymentMethod = pix
        boleto:
          $ref: '#/components/schemas/Boleto'
          description: Obrigatório quando paymentMethod = boleto
        customer:
          $ref: '#/components/schemas/CustomerRequest'
          description: Dados do cliente.
        items:
          type: array
          items:
            $ref: '#/components/schemas/Item'
        metadata:
          $ref: '#/components/schemas/TransactionMetadata'
        shipping:
          $ref: '#/components/schemas/Shipping'
        postbackUrl:
          type: string
          example: https://webhook.minhaloja.com/bee
        traceable:
          type: boolean
          description: Se status de entrega será gerenciado pelo painel
          default: false
        ip:
          type: string
          example: 189.10.20.30
        externalRef:
          type: string
          example: order_123
        splits:
          type: array
          items:
            $ref: '#/components/schemas/Split'
    Transaction:
      type: object
      properties:
        id:
          type: integer
          example: 12345
        amount:
          type: integer
          example: 500
        refundedAmount:
          type: integer
          example: 0
        companyId:
          type: integer
          example: 77
        installments:
          type: integer
          example: 1
        paymentMethod:
          type: string
          example: credit_card
        status:
          type: string
          example: paid
        postbackUrl:
          type: string
          example: https://webhook.minhaloja.com/bee
        metadata:
          $ref: '#/components/schemas/TransactionMetadata'
        traceable:
          type: boolean
          example: false
        secureId:
          type: string
          example: sec_abc123
        secureUrl:
          type: string
          example: https://checkout.paybeehive.com/sec_abc123
        createdAt:
          type: string
          example: '2026-01-04T12:00:00Z'
        updatedAt:
          type: string
          example: '2026-01-04T12:00:10Z'
        paidAt:
          type: string
          example: '2026-01-04T12:00:20Z'
        ip:
          type: string
          example: 189.10.20.30
        externalRef:
          type: string
          example: order_123
        customer:
          $ref: '#/components/schemas/Customer'
        address:
          $ref: '#/components/schemas/Address'
        card:
          $ref: '#/components/schemas/Card'
        boleto:
          type: string
          nullable: true
          example: null
        pix:
          type: string
          nullable: true
          example: null
        shipping:
          $ref: '#/components/schemas/Shipping'
        refusedReason:
          type: string
          nullable: true
          example: null
        items:
          type: array
          items:
            $ref: '#/components/schemas/Item'
        splits:
          type: array
          items:
            $ref: '#/components/schemas/Split'
        refunds:
          type: array
          items:
            $ref: '#/components/schemas/Refund'
        fee:
          $ref: '#/components/schemas/Fee'
    Card:
      type: object
      properties:
        id:
          type: integer
          example: 10
        hash:
          type: string
          description: Hash do cartão (válida por 5 minutos). Não armazenar.
          example: card_hash_abc
        number:
          type: string
          example: '4111111111111111'
        holderName:
          type: string
          example: Bruce Wayne
        expirationMonth:
          type: integer
          example: 12
        expirationYear:
          type: integer
          example: 2030
        cvv:
          type: string
          example: '123'
        brand:
          type: string
          example: visa
        lastDigits:
          type: string
          example: '1111'
        reusable:
          type: boolean
          example: true
        createdAt:
          type: string
          example: '2026-01-04T12:00:00Z'
    Pix:
      type: object
      properties:
        expiresInSeconds:
          type: integer
          example: 3600
    Boleto:
      type: object
      properties:
        expiresInDays:
          type: integer
          example: 3
    CustomerRequest:
      type: object
      required:
        - name
        - email
        - document
      properties:
        externalRef:
          type: string
          example: cust_ext_001
        name:
          type: string
          example: Bruce Wayne
        email:
          type: string
          example: bruce@wayne.com
        phone:
          type: string
          example: '+5511999999999'
        birthdate:
          type: string
          example: '1990-01-01'
        document:
          $ref: '#/components/schemas/Document'
        address:
          $ref: '#/components/schemas/Address'
    Item:
      type: object
      required:
        - title
        - unitPrice
        - quantity
        - tangible
      properties:
        externalRef:
          type: string
          example: item_ext_001
        title:
          type: string
          example: Produto X
        unitPrice:
          type: integer
          description: Preço em centavos
          example: 5000
        quantity:
          type: integer
          example: 1
        tangible:
          type: boolean
          example: true
    TransactionMetadata:
      type: object
      additionalProperties: false
      required:
        - provider
        - user_email
        - order_id
        - checkout_url
        - shop_url
      properties:
        provider:
          type: string
          description: Provedor/origem do checkout.
          example: CustomCheckout
        user_email:
          type: string
          example: cliente@exemplo.com
        order_id:
          type: string
          example: CC-20260121-000392
        checkout_url:
          type: string
          example: >-
            https://seguro.minhaloja.com.br/checkout/sucesso?order_id=CC-20260121-000392
        shop_url:
          type: string
          example: https://minhaloja.com.br
    Shipping:
      type: object
      properties:
        address:
          $ref: '#/components/schemas/Address'
        fee:
          type: integer
          example: 0
        deliveryDate:
          type: string
          example: '2026-01-10'
    Split:
      type: object
      required:
        - recipientId
        - amount
      properties:
        recipientId:
          type: integer
          example: 321
        amount:
          type: integer
          example: 500
        netAmount:
          type: integer
          example: 475
    Customer:
      allOf:
        - $ref: '#/components/schemas/CustomerRequest'
        - type: object
          properties:
            id:
              type: integer
              example: 123
            createdAt:
              type: string
              example: '2026-01-04T12:00:00Z'
    Address:
      type: object
      properties:
        street:
          type: string
          example: Av. Brigadeiro Faria Lima
        streetNumber:
          type: string
          example: '1811'
        complement:
          type: string
          example: Conj 1119
        neighborhood:
          type: string
          example: Itaim Bibi
        city:
          type: string
          example: São Paulo
        state:
          type: string
          example: SP
        zipCode:
          type: string
          example: '01452001'
        country:
          type: string
          example: BR
    Refund:
      type: object
      properties:
        id:
          type: integer
          example: 999
        amount:
          type: integer
          example: 5000
        createdAt:
          type: string
          example: '2026-01-04T12:10:00Z'
    Fee:
      type: object
      properties:
        fixedAmount:
          type: integer
          example: 199
        spreadPercentage:
          type: integer
          example: 349
        estimatedFee:
          type: integer
          example: 320
        netAmount:
          type: integer
          example: 4680
    Error:
      type: object
      properties:
        message:
          type: string
          example: Invalid request
        code:
          type: string
          example: bad_request
        details:
          type: object
          additionalProperties: true
    Document:
      type: object
      properties:
        number:
          type: string
          example: '12345678909'
        type:
          type: string
          example: cpf
  responses:
    BadRequest:
      description: Requisição inválida
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Não autorizado
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    UnprocessableEntity:
      description: Erro de validação
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InternalServerError:
      description: Erro interno
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
      description: Basic Authorization usando SECRET_KEY como usuário e "x" como senha.
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: Header x-api-key (se habilitado).

````