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

# Criar invoice Stripe de recarga de saldo



## OpenAPI

````yaml /api-reference/openapi.json post /v2/billing/invoices
openapi: 3.1.0
info:
  title: Base39 API
  description: Base39 API
  version: 1.0.0
  contact:
    name: Base39 Team
    url: https://base39.com.br
    email: suporte@base39.com.br
  termsOfService: https://base39.com.br/termos
  license:
    name: Proprietary
    url: https://base39.com.br/termos
servers:
  - url: http://localhost:3000
    description: Local
  - url: https://api.dev.base39.cloud
    description: Development
  - url: https://api.base39.com.br
    description: Production
security:
  - OAuth2: []
tags:
  - name: pages
    description: Profiles and reports pages
  - name: pipelines
    description: Pipeline boards (kanban) of pages
  - name: blocks
    description: Blocks operations
  - name: search
    description: Search across content
  - name: targets
    description: Lookup targets via datasets
  - name: CognitoTriggers
    description: Cognito triggers
paths:
  /v2/billing/invoices:
    post:
      tags:
        - billing
      summary: Criar invoice Stripe de recarga de saldo
      operationId: billing_create_invoice
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateBillingInvoiceInput'
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BillingInvoiceOutput'
components:
  schemas:
    CreateBillingInvoiceInput:
      type: object
      properties:
        option:
          type: string
          description: Opção de recarga de saldo
          enum:
            - balance_100_90d
            - balance_500_90d
            - balance_1000_90d
            - balance_5000_90d
            - balance_custom_90d
        customAmount:
          type: number
          description: Valor personalizado da recarga em centavos
          minimum: 2000
          maximum: 99999999
        whatsapp:
          description: >-
            Contexto WhatsApp para atualização de status do pedido quando a
            invoice for paga
          allOf:
            - $ref: '#/components/schemas/CreateBillingInvoiceWhatsappContextInput'
        checkoutMode:
          type: string
          description: Modo de checkout Stripe para recarga
          enum:
            - hosted
            - elements
        paymentMethod:
          type: string
          description: Meio de pagamento preferido para a recarga
          enum:
            - pix
            - stripe_checkout
      required:
        - option
    BillingInvoiceOutput:
      type: object
      properties:
        invoiceId:
          type: string
          description: ID da invoice Stripe
          example: in_xxx
        paymentMethods:
          description: Meios de pagamento gerados com sucesso
          type: array
          items:
            $ref: '#/components/schemas/BillingPaymentMethodOutput'
        paymentAction:
          description: Ação hospedada para concluir o pagamento
          allOf:
            - $ref: '#/components/schemas/BillingInvoicePaymentActionOutput'
        checkout:
          description: Checkout Stripe Elements para pagamento no frontend
          allOf:
            - $ref: '#/components/schemas/BillingInvoiceCheckoutOutput'
      required:
        - invoiceId
        - paymentMethods
    CreateBillingInvoiceWhatsappContextInput:
      type: object
      properties:
        phoneNumberId:
          type: string
          description: ID do phone number da WhatsApp Cloud API usado no envio da cobrança
        waIdentifier:
          type: string
          description: >-
            Identificador de destino no WhatsApp: número ou BSUID usado no envio
            da cobrança
      required:
        - phoneNumberId
        - waIdentifier
    BillingPaymentMethodOutput:
      type: object
      properties:
        type:
          type: string
          enum:
            - pix
            - boleto
        status:
          type: string
          enum:
            - ready
            - requires_action
            - unavailable
        value:
          type: string
          description: Pix copia e cola ou linha digitável do boleto
        pdfUrl:
          type: string
          description: URL do PDF do boleto
        unavailableReason:
          type: string
          description: Motivo pelo qual o método não está disponível
      required:
        - type
        - status
    BillingInvoicePaymentActionOutput:
      type: object
      properties:
        type:
          type: string
          enum:
            - hosted_page
        url:
          type: string
          description: URL hospedada para concluir o pagamento
      required:
        - type
        - url
    BillingInvoiceCheckoutOutput:
      type: object
      properties:
        sessionId:
          type: string
          description: ID da PaymentIntent Stripe
          example: pi_xxx
        clientSecret:
          type: string
          description: Client secret da Checkout Session para Payment Element
        publishableKey:
          type: string
          description: Publishable key Stripe para inicializar Stripe.js
        customPaymentMethodTypeId:
          type: string
          description: ID do custom payment method Pix criado no Stripe Dashboard
          example: cpmt_xxx
      required:
        - sessionId
        - clientSecret
        - publishableKey
        - customPaymentMethodTypeId
  securitySchemes:
    OAuth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://id.local.base39.cloud/oauth2/authorize
          tokenUrl: https://id.local.base39.cloud/oauth2/token
          scopes:
            profile: Read user profile
            email: Read user email
            openid: OpenID authentication
      description: OAuth2 Authorization Code flow

````