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

# Enlace de pago de una factura del cliente

> Reutiliza el enlace de MercadoPago guardado en el DTE vinculado; si no hay, crea la preferencia y la guarda.



## OpenAPI

````yaml /generated/specs/atlas-portal.json post /api/v1/internal/atlas-portal/clients/{atlasClientId}/invoices/{invoiceId}/payment-link
openapi: 3.0.0
info:
  title: Raul API - Portal del cliente (Atlas)
  description: >-
    Namespace interno que consume el backend de Atlas: facturacion y soporte de
    un cliente comercial resuelto por Client.atlas_client_id, con token de
    servicio propio.
  version: 2.0.0
  contact: {}
servers:
  - url: https://api.raul.ugps.io
    description: Production
security: []
tags: []
paths:
  /api/v1/internal/atlas-portal/clients/{atlasClientId}/invoices/{invoiceId}/payment-link:
    post:
      tags:
        - Atlas portal
      summary: Enlace de pago de una factura del cliente
      description: >-
        Reutiliza el enlace de MercadoPago guardado en el DTE vinculado; si no
        hay, crea la preferencia y la guarda.
      operationId: AtlasPortalPaymentController_createInvoicePaymentLink
      parameters:
        - name: atlasClientId
          required: true
          in: path
          description: >-
            Id del client de Atlas (24 hex); se resuelve contra
            Client.atlas_client_id
          schema:
            type: string
            example: 64f1c0ffee0ddba11ce55aa1
        - name: invoiceId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AtlasPortalInvoicePaymentLinkResponseDto'
        '401':
          description: Token de servicio inválido (UNAUTHORIZED)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AtlasPortalErrorResponseDto'
        '404':
          description: >-
            Sin vínculo o factura de otro cliente (CLIENT_NOT_LINKED,
            INVOICE_NOT_FOUND)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AtlasPortalErrorResponseDto'
        '409':
          description: >-
            La factura no admite pago en línea: sin DTE, pagada, anulada o sin
            saldo (INVOICE_NOT_PAYABLE)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AtlasPortalErrorResponseDto'
      security:
        - bearerAuth: []
components:
  schemas:
    AtlasPortalInvoicePaymentLinkResponseDto:
      type: object
      properties:
        contractVersion:
          type: number
          description: Versión del contrato; el consumidor acepta la vigente y la anterior
          example: 1
          minimum: 1
        invoiceId:
          type: string
          format: uuid
        initPoint:
          type: string
          description: Enlace https de MercadoPago al que navega el cliente
          example: https://www.mercadopago.cl/checkout/v1/redirect?pref_id=1
        amount:
          type: number
          description: Saldo cobrado en CLP
          minimum: 0
      required:
        - contractVersion
        - invoiceId
        - initPoint
        - amount
    AtlasPortalErrorResponseDto:
      type: object
      properties:
        contractVersion:
          type: number
          description: Versión del contrato; el consumidor acepta la vigente y la anterior
          example: 1
          minimum: 1
        code:
          type: string
          enum:
            - CLIENT_NOT_LINKED
            - CLIENT_WITHOUT_ATLAS_LINK
            - INVOICE_NOT_FOUND
            - INVOICE_NOT_PAYABLE
            - TICKET_NOT_FOUND
            - TICKET_CLOSED
            - TOKEN_INVALID
            - TOKEN_WITHOUT_EMAIL
            - VALIDATION_ERROR
            - UNAUTHORIZED
        message:
          type: string
      required:
        - contractVersion
        - code
        - message
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Token de sesión Better Auth para rutas de backoffice; las rutas de
        portal usan su token propio.

````

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