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

# Simular resultado (teste)

> Só com chave `vk_test_…`. Simula o resultado do link e dispara os webhooks do tipo webhook com `"test": true`. Não cria pedido nem cobra nada.



## OpenAPI

````yaml /api-reference/openapi-pagamentos.json post /v1/payment-links/{id}/simulate
openapi: 3.1.0
info:
  title: Velan · API de pagamentos
  version: 1.0.0
  description: >-
    Crie links de pagamento de ofertas e planos de assinatura e acompanhe o
    pagamento. Use uma chave `vk_live_…` para produção ou `vk_test_…` para o
    ambiente de teste (nada é cobrado).
servers:
  - url: https://open.velan.app
    description: Produção e teste (o modo vem da chave)
security:
  - bearerAuth: []
tags:
  - name: Links de pagamento
  - name: Ofertas e planos
  - name: Ambiente de teste
paths:
  /v1/payment-links/{id}/simulate:
    post:
      tags:
        - Ambiente de teste
      summary: Simular resultado (teste)
      description: >-
        Só com chave `vk_test_…`. Simula o resultado do link e dispara os
        webhooks do tipo webhook com `"test": true`. Não cria pedido nem cobra
        nada.
      operationId: simulatePaymentLink
      parameters:
        - name: id
          in: path
          required: true
          description: Identificador do link (`id` devolvido na criação).
          schema:
            type: string
          example: jW20RTHT6hN2-x3AQoaSRg
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - outcome
              properties:
                outcome:
                  type: string
                  enum:
                    - paid
                    - failed
                    - expired
                  description: >-
                    `paid` → order.paid; `failed` → order.payment_declined (link
                    segue ativo); `expired` → order.expired.
            example:
              outcome: paid
      responses:
        '200':
          description: Simulação aplicada.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/PaymentLink'
                  - type: object
                    properties:
                      simulation:
                        $ref: '#/components/schemas/Simulation'
        '400':
          description: Chave de produção, resultado inválido ou link não ativo.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Chave ausente, inválida ou revogada.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Chave sem acesso à API de pagamentos.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Link de teste não encontrado.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Limite de requisições atingido.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    PaymentLink:
      type: object
      properties:
        object:
          const: payment_link
        id:
          type: string
        livemode:
          type: boolean
          description: '`false` para links criados com chave de teste.'
        status:
          $ref: '#/components/schemas/PaymentLinkStatus'
        type:
          type: string
          enum:
            - offer
            - plan
        offer_code:
          type:
            - string
            - 'null'
        plan_code:
          type:
            - string
            - 'null'
        url:
          type: string
          format: uri
        short_url:
          type: string
          format: uri
        customer:
          type: object
          properties:
            name:
              type:
                - string
                - 'null'
            email:
              type:
                - string
                - 'null'
            phone:
              type:
                - string
                - 'null'
            document:
              type:
                - string
                - 'null'
        external_reference:
          type:
            - string
            - 'null'
        metadata:
          type: object
          additionalProperties:
            type: string
        coupon_code:
          type:
            - string
            - 'null'
        single_use:
          type: boolean
        expires_at:
          type:
            - string
            - 'null'
          format: date-time
        paid_at:
          type:
            - string
            - 'null'
          format: date-time
        canceled_at:
          type:
            - string
            - 'null'
          format: date-time
        created_at:
          type: string
          format: date-time
        order:
          oneOf:
            - $ref: '#/components/schemas/Order'
            - type: 'null'
    Simulation:
      type: object
      properties:
        event:
          type: string
          example: order.paid
        webhooks:
          type: array
          items:
            type: object
            properties:
              integration_id:
                type: integer
              destination:
                type:
                  - string
                  - 'null'
              success:
                type: boolean
              status:
                type:
                  - integer
                  - 'null'
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            type:
              type: string
              enum:
                - validation_error
                - authentication_error
                - permission_error
                - not_found
                - conflict
                - rate_limited
                - api_error
            message:
              type: string
            fields:
              type: object
            retry_after_seconds:
              type: integer
    PaymentLinkStatus:
      type: string
      enum:
        - active
        - paid
        - expired
        - canceled
    Order:
      type: object
      properties:
        code:
          type: string
          format: uuid
        status:
          type: string
        amount:
          type: string
          example: '1000.00'
        payment_method:
          type:
            - string
            - 'null'
        paid_at:
          type:
            - string
            - 'null'
          format: date-time
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: vk_live_… | vk_test_…
      description: >-
        Chave criada no painel em Configurações → Chaves de API → Nova chave →
        API de pagamentos (dash.velan.app/dashboard/settings/api-keys).

````

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