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

# Create a checkout session from a payment link (by token)

> Rota pública, sem autenticação. A sessão é de uso único.



## OpenAPI

````yaml /api-reference/openapi.json post /api/v1/p/{token}/session
openapi: 3.0.0
info:
  title: PlugToPay API
  description: API to make payments easy in multiple gateways.
  version: 1.0.0
servers:
  - url: http://localhost:7701
    description: Test Server
security: []
paths:
  /api/v1/p/{token}/session:
    post:
      tags:
        - Payment Links
      summary: Create a checkout session from a payment link (by token)
      description: Rota pública, sem autenticação. A sessão é de uso único.
      parameters:
        - name: token
          in: path
          required: true
          schema:
            type: string
            example: pl_live_a1b2c3d4e5f6
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                full_name:
                  type: string
                  example: Maria Silva
                email:
                  type: string
                  format: email
                  example: maria.silva@example.com
                cpf_cnpj:
                  type: string
                  description: CPF (11 dígitos) ou CNPJ (14 dígitos)
                  example: '12345678909'
                coupon_code:
                  type: string
                  nullable: true
                  description: Só se aplica a links de assinatura.
              type: object
              required:
                - full_name
                - email
                - cpf_cnpj
      responses:
        '201':
          description: Sessão de checkout criada — use o token como X-Checkout-Token
          content:
            application/json:
              schema:
                properties:
                  token:
                    type: string
                    example: cs_live_a1b2c3...
                  type:
                    type: string
                    enum:
                      - one_time
                      - subscription
                  plan_id:
                    type: integer
                    nullable: true
                  amount:
                    description: >-
                      Nulo em sessões de link de assinatura — o valor vem do
                      plano.
                    type: integer
                    nullable: true
                    example: 29900
                  currency:
                    type: string
                    example: BRL
                  merchant_order_id:
                    description: >-
                      Gerado automaticamente (pl_…) quando a sessão nasce de um
                      link de pagamento.
                    type: string
                    example: pl_6a1f2c3d
                  payment_method:
                    type: string
                    enum:
                      - card
                      - pix
                    nullable: true
                  gateway_first_try:
                    type: string
                    nullable: true
                  metadata:
                    type: object
                    nullable: true
                  success_url:
                    type: string
                    format: uri
                    nullable: true
                  cancel_url:
                    type: string
                    format: uri
                    nullable: true
                  expires_at:
                    type: string
                    format: date-time
                  saved_cards:
                    type: array
                    items:
                      type: object
                    description: >-
                      Sempre vazio em links de pagamento — a página pública
                      nunca expõe cartões salvos.
                type: object
        '404':
          description: Link inexistente, inativo, expirado ou removido
        '422':
          description: Erro de validação nos dados de identificação

````