> ## 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.

# Criar link de pagamento

> Cria um link para uma oferta (`offer_code`) ou um plano (`plan_code`). Com chave de teste, o link abre a página de simulação.



## OpenAPI

````yaml /api-reference/openapi-pagamentos.json post /v1/payment-links
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:
    post:
      tags:
        - Links de pagamento
      summary: Criar link de pagamento
      description: >-
        Cria um link para uma oferta (`offer_code`) ou um plano (`plan_code`).
        Com chave de teste, o link abre a página de simulação.
      operationId: createPaymentLink
      parameters:
        - name: Idempotency-Key
          in: header
          required: false
          description: >-
            Até 64 caracteres. Repetir a mesma chave devolve o mesmo link (200)
            sem criar outro.
          schema:
            type: string
            maxLength: 64
          example: fatura-2026-0042
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PaymentLinkCreate'
            example:
              offer_code: 8255qmu6
              customer:
                name: Maria Souza
                email: maria@exemplo.com
                phone: '5511999998888'
                document: '52998224725'
              external_reference: fatura-2026-0042
              metadata:
                crm_id: '8812'
              expires_at: '2026-10-20T23:59:59-03:00'
      responses:
        '200':
          description: Link já existente para a mesma `Idempotency-Key`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentLink'
        '201':
          description: Link criado.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentLink'
              example:
                object: payment_link
                id: jW20RTHT6hN2-x3AQoaSRg
                livemode: true
                status: active
                type: offer
                offer_code: 8255qmu6
                plan_code: null
                url: https://pay.velan.app/8255qmu6?plink=jW20RTHT6hN2-x3AQoaSRg
                short_url: https://pay.velan.app/r/fcgbvr3b
                customer:
                  name: Maria Souza
                  email: maria@exemplo.com
                  phone: '+5511999998888'
                  document: '52998224725'
                external_reference: fatura-2026-0042
                metadata:
                  crm_id: '8812'
                coupon_code: null
                single_use: true
                expires_at: '2026-10-21T02:59:59Z'
                paid_at: null
                canceled_at: null
                created_at: '2026-10-13T17:36:23Z'
                order: null
        '400':
          description: Campo inválido. `fields` indica qual.
          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'
        '429':
          description: Limite de requisições atingido.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    PaymentLinkCreate:
      type: object
      properties:
        offer_code:
          type: string
          description: Código da oferta. Envie este ou `plan_code`.
        plan_code:
          type: string
          description: Código do plano de assinatura.
        customer:
          $ref: '#/components/schemas/CustomerInput'
        external_reference:
          type: string
          maxLength: 128
          description: Sua referência. Volta na API e nos webhooks.
        metadata:
          type: object
          maxProperties: 20
          additionalProperties:
            type: string
            maxLength: 500
        coupon_code:
          type: string
          maxLength: 32
        single_use:
          type: boolean
          default: true
        expires_at:
          type: string
          format: date-time
          description: 'Padrão: 7 dias. Máximo: 90 dias.'
    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'
    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
    CustomerInput:
      type: object
      properties:
        name:
          type: string
          maxLength: 160
        email:
          type: string
          format: email
        phone:
          type: string
          description: DDI + DDD + número, só dígitos ou com máscara.
          example: '5511999998888'
        document:
          type: string
          description: CPF (11) ou CNPJ (14 dígitos).
          example: '52998224725'
    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.