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

# Busca ordem



## OpenAPI

````yaml GET /orders/{id}
openapi: 3.1.0
info:
  title: Astron Pay API
  version: 1.0.0
  description: >-
    API B2B para integração de câmbio crypto ↔ BRL via PIX. Autentique com
    `x-api-key` + `x-api-secret`.
  contact:
    name: Astron Pay
    url: https://astronpay.co
    email: dev@astronpay.co
servers:
  - url: https://api.astronpay.co/api/v1
    description: Production
security:
  - apiKey: []
    apiSecret: []
  - bearerAuth: []
tags:
  - name: Fee Tiers
    description: Consulta e atualização das taxas do merchant.
  - name: Receivers
    description: CRUD, KYC, limites e wallet signing dos receivers.
  - name: Quote
    description: Cotações de payin e payout.
  - name: Payin
    description: Ordens de entrada (BRL → crypto).
  - name: Payout
    description: Ordens de saída (crypto → BRL).
  - name: Orders
    description: Consulta genérica de ordens.
  - name: Merchant Wallet
    description: Assinatura de transações com a wallet gerenciada do merchant.
  - name: Ledger
    description: Saldos, entries e liquidações.
  - name: Webhook Config
    description: Configuração de webhook e listagem de eventos.
paths:
  /orders/{id}:
    get:
      tags:
        - Orders
      summary: Busca ordem por ID (payin ou payout)
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Order'
        '404':
          description: Não encontrada
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Order:
      type: object
      required:
        - id
        - merchantId
        - receiverId
        - type
        - status
        - chain
        - createdAt
        - updatedAt
      properties:
        id:
          type: string
          format: uuid
        externalId:
          type: string
          nullable: true
          description: ID do merchant para rastreamento interno.
        merchantId:
          type: string
          format: uuid
        receiverId:
          type: string
          format: uuid
        receiverName:
          type: string
          nullable: true
        merchantName:
          type: string
          nullable: true
        type:
          type: string
          enum:
            - PAYIN
            - PAYOUT
        status:
          type: string
          enum:
            - PENDING
            - AWAITING_PAYMENT
            - PAYMENT_RECEIVED
            - SWAPPING
            - TRANSFERRING
            - AWAITING_DEPOSIT
            - DEPOSIT_RECEIVED
            - PIX_SENDING
            - PIX_SENT_UNCONFIRMED
            - COMPLETED
            - FAILED
            - EXPIRED
            - REFUNDING
            - REFUNDED
        chain:
          type: string
          example: solana
        amountBrl:
          type: number
          nullable: true
          example: 1000
        amountCrypto:
          type: number
          nullable: true
          example: 199.5
        targetToken:
          type: string
          nullable: true
          description: 'Payin only. Token que o receiver recebe (ex: USDC).'
          example: USDC
        sourceToken:
          type: string
          nullable: true
          description: 'Payout only. Token que o receiver envia (ex: USDC).'
          example: USDC
        destinationWallet:
          type: string
          nullable: true
          description: Payin only. Endereço Solana onde o crypto é entregue.
          example: 4k5dSo1EnderecoSolana...
        depositAddress:
          type: string
          nullable: true
          description: >-
            Payout only. Endereço Solana para onde o receiver deve enviar o
            crypto.
          example: 7xMnSo2EnderecoDeposito...
        paymentReference:
          type: string
          nullable: true
          description: >-
            Payout only. PublicKey Solana **não custodial** (sem chave privada,
            sem saldo) usada como reference no padrão Solana Pay para
            correlacionar o depósito on-chain a esta order. Inclua essa pubkey
            como account read-only e não-signer na sua transação SPL Transfer —
            sem isso, a plataforma não consegue identificar que o depósito
            pertence a este payout e a order expira em `AWAITING_DEPOSIT`.
        exchangeRate:
          type: number
          nullable: true
          description: Taxa de câmbio utilizada na ordem (BRL/token).
          example: 5.01
        feePercentage:
          type: number
          nullable: true
          description: Percentual total de taxa aplicado.
          example: 2.5
        netAmountBrl:
          type: number
          nullable: true
          description: Valor BRL líquido após taxas.
          example: 975
        amountUsdc:
          type: number
          nullable: true
          example: 194.61
        amountToken:
          type: number
          nullable: true
          description: Quantidade final do token entregue.
          example: 194.61
        platformFeePercentage:
          type: number
          nullable: true
          example: 1.5
        platformFeeAmountBrl:
          type: number
          nullable: true
          example: 15
        merchantFeePercentage:
          type: number
          nullable: true
          example: 1
        merchantFeeAmountBrl:
          type: number
          nullable: true
          example: 10
        pixPaymentCode:
          type: string
          nullable: true
          description: Payin only. Código EMV copia-e-cola do PIX.
          example: 00020126...
        pixKey:
          type: string
          nullable: true
          description: Payout only. Chave PIX do destinatário.
        pixKeyType:
          type: string
          nullable: true
          enum:
            - CPF
            - CNPJ
            - PHONE
            - EMAIL
            - RANDOM
            - QRCODE
          description: Payout only. Tipo da chave PIX.
        recipientName:
          type: string
          nullable: true
          description: Payout only. Nome do destinatário no PIX.
        failureReason:
          type: string
          nullable: true
          description: Motivo da falha, preenchido quando status=FAILED.
        expiresAt:
          type: string
          format: date-time
          nullable: true
        completedAt:
          type: string
          format: date-time
          nullable: true
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        transactions:
          type: array
          items:
            $ref: '#/components/schemas/Transaction'
          description: Transações associadas à ordem (on-chain e PIX).
    Error:
      type: object
      required:
        - error
        - message
      properties:
        error:
          type: string
          example: VALIDATION_ERROR
        message:
          type: string
          example: Campo 'amountBrl' é obrigatório
        details:
          type: object
          additionalProperties: true
        requestId:
          type: string
          example: req_abc123
    Transaction:
      type: object
      required:
        - id
        - type
        - status
        - amount
        - currency
        - createdAt
      properties:
        id:
          type: string
          format: uuid
        type:
          type: string
          description: 'Tipo da transação (ex: PIX_IN, SWAP, TRANSFER_OUT).'
        status:
          type: string
          description: Status da transação.
        chain:
          type: string
          nullable: true
          example: solana
        amount:
          type: number
          example: 199.5
        currency:
          type: string
          example: USDC
        txHash:
          type: string
          nullable: true
          description: Hash on-chain da transação, quando aplicável.
        createdAt:
          type: string
          format: date-time
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
    apiSecret:
      type: apiKey
      in: header
      name: x-api-secret
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````