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

# Criar Checkout

> Cria um checkout linkado a um produto. O campo `slug` é gerado automaticamente se não informado. O checkout pode ser compartilhado via URL.



## OpenAPI

````yaml POST /v1/checkouts
openapi: 3.1.0
info:
  title: Valora Payment Gateway
  description: >-
    Gateway de pagamentos brasileiro com suporte a PIX e cripto (USDT/USDC/EURC
    na rede Solana).


    ## Autenticação

    Todas as rotas exigem o header `x-api-key` com sua chave de API.


    ## Convenção de valores

    - **Request**: valores em **centavos** (inteiro). Ex: `5000` = R$50,00

    - **Response**: valores em **BRL** (float). Ex: `50.0` = R$50,00


    ## Formato de erro

    Todos os erros retornam `{ "error": { "code": "ERROR_CODE", "message": "..."
    } }`
  version: 1.0.0
  contact:
    name: Suporte Valora
    url: https://valorapayments.com.br
servers:
  - url: https://api.valorapayments.com.br
    description: Produção
  - url: https://sandbox.api.valorapayments.com.br
    description: Sandbox
security:
  - ApiKey: []
paths:
  /v1/checkouts:
    post:
      tags:
        - Checkouts
      summary: Criar checkout
      description: >-
        Cria um checkout linkado a um produto. O campo `slug` é gerado
        automaticamente se não informado. O checkout pode ser compartilhado via
        URL.
      operationId: createCheckout
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CheckoutCreateRequest'
            example:
              product_id: prod_abc123
              return_url: https://meusite.com/obrigado
              cancel_url: https://meusite.com/cancelado
              title: Plano Premium
              slug: plano-premium
      responses:
        '201':
          description: Checkout criado
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CheckoutObject'
        '409':
          description: Slug já está em uso
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: CHECKOUT_SLUG_TAKEN
                  message: Este slug já está em uso. Por favor, escolha outro.
        '422':
          $ref: '#/components/responses/ValidationError'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  schemas:
    CheckoutCreateRequest:
      type: object
      required:
        - product_id
        - return_url
        - cancel_url
      properties:
        product_id:
          type: string
          description: ID do produto cadastrado na Valora
          example: prod_abc123
        return_url:
          type: string
          format: uri
          description: URL de redirecionamento após pagamento bem-sucedido
        cancel_url:
          type: string
          format: uri
          description: URL de redirecionamento após cancelamento
        title:
          type: string
          description: Título exibido na página de checkout
          example: Plano Premium
        slug:
          type: string
          description: >-
            Slug personalizado para a URL do checkout. Gerado automaticamente se
            omitido.
          example: plano-premium
        metadata:
          type: string
          description: JSON serializado com dados extras
    CheckoutObject:
      type: object
      properties:
        checkout_id:
          type: string
          example: chk_a1b2c3d4
        business_id:
          type: string
        product_id:
          type: string
        slug:
          type: string
          example: plano-premium-x7a3b2c1
        title:
          type: string
          nullable: true
        return_url:
          type: string
        cancel_url:
          type: string
        metadata:
          type: string
          nullable: true
        status:
          type: string
          enum:
            - active
            - inactive
        created_at:
          type: string
          format: date-time
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: Código de erro em SNAKE_UPPER_CASE
              example: NOT_FOUND
            message:
              type: string
              description: Descrição legível do erro
              example: Pagamento não encontrado.
  responses:
    ValidationError:
      description: Dados inválidos na requisição
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            missing_fields:
              value:
                error:
                  code: MISSING_FIELDS
                  message: 'Campos obrigatórios ausentes: payment_method, amount.'
            invalid_status:
              value:
                error:
                  code: INVALID_STATUS
                  message: >-
                    Não é possível realizar esta operação em pagamento com
                    status "paid".
            no_fee_rule:
              value:
                error:
                  code: NO_FEE_RULE
                  message: >-
                    Nenhuma regra de taxa configurada para este método de
                    pagamento.
            unsupported_method:
              value:
                error:
                  code: UNSUPPORTED_PAYMENT_METHOD
                  message: Método de pagamento não suportado.
    RateLimited:
      description: Limite de requisições excedido (60 req/min por API key)
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: RATE_LIMITED
              message: Muitas requisições. Tente novamente em alguns instantes.
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: Chave de API gerada no painel Valora. Envie em todas as requisições.

````