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

# Payments

> Payment endpoints: code validation, quoting, creation, submission, listing, lookup, and receipts.

The payment endpoints cover the full lifecycle of a transaction: validate the destination code, quote, create, submit, and look up. They require JWT token authentication, except for code validation, which is public.

<Info>
  The complete flow is described in [Usage and Examples](/en/sdks/usage-examples). The final receipt is also described here, in the Receipts section.
</Info>

## Validate code

Validates a payment code (PIX, boleto, or gift card) before quoting.

<ParamField body="code" type="string" required>
  Payment code to validate (for example, a PIX BR Code starting with `00020101...`).
</ParamField>

<ResponseField name="data" type="object">
  Details of the validated payment destination (type, amount, beneficiary).
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://app.pag.finance/api/payments/validate-code \
    -H "Content-Type: application/json" \
    -d '{ "code": "00020101..." }'
  ```

  ```ts SDK theme={null}
  const transfer = await client.payments.validateCode({ code: '00020101...' });
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "success": true,
    "data": {
      "type": "pix",
      "amount": 150.00,
      "currency": "BRL"
    }
  }
  ```
</ResponseExample>

## Quote payment

Requests a quote for the payment, indicating the source asset and blockchain.

<ParamField header="Authorization" type="string" required>
  `Bearer <tokenJWT>`
</ParamField>

<RequestExample>
  ```ts SDK theme={null}
  const quote = await client.payments.quote({
    code: '00020101...',
    assetId: 1,
    blockchain: 'solana',
  });
  ```
</RequestExample>

## Create payment

Creates the payment from a valid quote.

<ParamField header="Authorization" type="string" required>
  `Bearer <tokenJWT>`
</ParamField>

<ParamField body="quoteId" type="string" required>
  Identifier of the previously obtained quote.
</ParamField>

<RequestExample>
  ```ts SDK theme={null}
  const payment = await client.payments.create({ quoteId: quote.id });
  ```
</RequestExample>

## Submit payment

Submits the on-chain transaction associated with the created payment.

<ParamField header="Authorization" type="string" required>
  `Bearer <tokenJWT>`
</ParamField>

<RequestExample>
  ```ts SDK theme={null}
  await client.payments.submit({ paymentId: payment.id, txHash: '...' });
  ```
</RequestExample>

## List payments

Lists the authenticated user's payments.

<ParamField header="Authorization" type="string" required>
  `Bearer <tokenJWT>`
</ParamField>

<RequestExample>
  ```ts SDK theme={null}
  const payments = await client.payments.list();
  ```
</RequestExample>

## Get payment

Returns a specific payment by its identifier.

<ParamField header="Authorization" type="string" required>
  `Bearer <tokenJWT>`
</ParamField>

<RequestExample>
  ```ts SDK theme={null}
  const payment = await client.payments.get(id);
  ```
</RequestExample>

## Receipts

Returns the receipt of a transaction. It is agnostic: it works for PIX, boleto, and gift card.

<ResponseField name="data" type="object">
  Receipt data (proof of payment, status, and settlement details).
</ResponseField>

<RequestExample>
  ```ts SDK theme={null}
  const receipt = await client.receipts.get({ type: 'pix', tx: '...', chain: 'solana' });
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "success": true,
    "data": {
      "type": "pix",
      "status": "settled",
      "receiptUrl": "https://..."
    }
  }
  ```
</ResponseExample>
