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

# Iniciar checkout do link

> Inicia checkout do link (PIX ou cripto).

<Note>
  **URL:** `POST https://api.goatpay.com.br/v1/payment-links/checkout` · Permissão: `payment-links/checkout` · Header opcional `Idempotency-Key`
</Note>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST 'https://api.goatpay.com.br/v1/payment-links/checkout' \
    -H 'X-API-Key: gp_live_SUA_CHAVE' \
    -H 'Content-Type: application/json' \
    -H 'Idempotency-Key: pedido-42-v1' \
    -d '{
      "linkId": "clx_link",
      "method": "PIX",
      "payerEmail": "cliente@loja.com",
      "externalReference": "pedido-42"
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json Success (PIX) theme={null}
  {
    "success": true,
    "message": "Checkout do link iniciado",
    "data": {
      "sessionId": "clx_session",
      "sessionToken": "uuid-token",
      "payCheckoutUrl": "https://pay.goatpay.com.br/pay/abc12/plano-pro/uuid-token",
      "paymentLinkId": "clx_link",
      "externalReference": "pedido-42"
    },
    "requestId": "req_abc"
  }
  ```
</ResponseExample>

### Corpo

<ParamField body="linkId" type="string" required>ID do link ([criar](/api-reference/endpoint/payment-links/create)).</ParamField>
<ParamField body="couponCode" type="string">Cupom validado com [POST /v1/coupons/validate](/api-reference/endpoint/coupons/validate).</ParamField>
<ParamField body="method" type="string" required>`PIX` ou `CRYPTO`.</ParamField>
<ParamField body="amount" type="number">Obrigatório se o link não tiver `fixedAmount`.</ParamField>
<ParamField body="externalReference" type="string">Sua referência (webhook e consulta).</ParamField>
<ParamField body="payerName" type="string">Nome do pagador.</ParamField>
<ParamField body="payerDocument" type="string">CPF/CNPJ.</ParamField>
<ParamField body="payerEmail" type="string">E-mail do pagador.</ParamField>

Após pagamento: webhook [`payment_link.paid`](/api-reference/guides/webhooks#links-de-pagamento) ou [consultar sessão](/api-reference/endpoint/payment-links/sessions-get).

Guia: [Links de pagamento](/api-reference/guides/loja#links-de-pagamento).


## OpenAPI

````yaml POST /payment-links/checkout
openapi: 3.1.0
info:
  title: GoatPay API
  description: >
    API pública merchant da GoatPay. Autenticação via header `X-API-Key:
    gp_live_...`.

    Respostas de sucesso usam o envelope `{ success, message, data, requestId
    }`.

    Campos internos (`accountId`, `metadata`, histórico de entregas de webhook,
    etc.) não são expostos.

    `providerTransactionId` aparece como `referenceId`; `providerInfractionId`
    como `infractionId`.

    Rate limit global: 100 requisições por minuto por API key (HTTP 429). Sem
    chave, limite por IP.
  version: 1.0.0
servers:
  - url: https://api.goatpay.com.br/v1
    description: Produção
security:
  - apiKeyAuth: []
tags:
  - name: pix
    description: >-
      Cobranças PIX (receber), reembolsos de depósito recebido e transferências
      PIX (enviar). Alias legado em payouts/* para envios.
  - name: transfer-internal
    description: Transferências entre contas GoatPay
  - name: transfer-scheduled
    description: Transferências programadas (agendar, repetir ou por saldo)
  - name: crypto
    description: Depósitos e transferências em criptomoeda
  - name: billings
    description: >-
      Cobranças avulsas (pagamento único) — boleto, cartão ou PIX na Conta
      Padrão (PF ou PJ)
  - name: subscriptions
    description: >-
      Assinaturas recorrentes com ciclo fixo — boleto, cartão ou PIX na Conta
      Padrão (PF ou PJ)
  - name: account
    description: Saldo e extrato
  - name: subaccount
    description: Subcontas merchant (carteiras lógicas sob a conta principal)
  - name: meds
    description: Disputas MED
  - name: webhooks
    description: Endpoints de webhook de saída
  - name: payouts
    description: Alias de transfer-pix para saques PIX
  - name: customers
    description: Clientes da loja (CRM)
  - name: products
    description: Produtos e entregas digitais
  - name: coupons
    description: Cupons de desconto para links
  - name: payment-links
    description: Links de pagamento e checkout hospedado
paths:
  /payment-links/checkout:
    post:
      tags:
        - payment-links
      summary: Iniciar checkout do link
      description: >
        PIX ou cripto. Header opcional `Idempotency-Key`.

        Redirecione para `payCheckoutUrl`. Confirme com webhook
        `payment_link.paid` ou GET sessions.
      operationId: checkoutPaymentLink
      parameters:
        - name: Idempotency-Key
          in: header
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PaymentLinkCheckout'
      responses:
        '200':
          $ref: '#/components/responses/PaymentLinkCheckoutSuccess'
components:
  schemas:
    PaymentLinkCheckout:
      type: object
      required:
        - linkId
        - method
      properties:
        linkId:
          type: string
        method:
          type: string
          enum:
            - PIX
            - CRYPTO
        amount:
          type: number
        payerName:
          type: string
        payerDocument:
          type: string
        payerEmail:
          type: string
        payerPhone:
          type: string
        couponCode:
          type: string
        externalReference:
          type: string
        successUrl:
          type: string
          format: uri
        cancelUrl:
          type: string
          format: uri
    PaymentLinkCheckoutResult:
      type: object
      properties:
        sessionId:
          type: string
        sessionToken:
          type: string
        payCheckoutUrl:
          type: string
        paymentLinkId:
          type: string
        externalReference:
          type: string
  responses:
    PaymentLinkCheckoutSuccess:
      description: Checkout iniciado.
      content:
        application/json:
          schema:
            type: object
            required:
              - success
              - message
              - data
            properties:
              success:
                type: boolean
              message:
                type: string
              data:
                $ref: '#/components/schemas/PaymentLinkCheckoutResult'
              requestId:
                type: string
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: Chave `gp_live_...` criada em Integrações → Chaves de API no dashboard.

````