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

# Accept Pix Payments

> Create a Pix transaction, return QR code data to the buyer, and operate the flow with webhooks plus reconciliation.

Use this page for the write path that starts a Pix collection.

## Happy path

1. Create a transaction with `method: "pix"`.
2. Return the Pix QR code data to the buyer.
3. Persist the Pagou transaction `id` and your `external_ref`.
4. Wait for webhook delivery.
5. Reconcile only when the payment state is uncertain.

## Example request

```bash theme={null}
curl --request POST \
  --url https://api.pagou.ai/v2/transactions \
  --header "Authorization: Bearer YOUR_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
    "external_ref": "order_1001",
    "amount": 1500,
    "currency": "BRL",
    "method": "pix",
    "notify_url": "https://shop.example/webhooks/pagou",
    "buyer": {
      "name": "Ada Lovelace",
      "email": "ada@example.com",
      "document": {
        "type": "CPF",
        "number": "12345678901"
      }
    },
    "products": [
      {
        "name": "Starter order",
        "price": 1500,
        "quantity": 1
      }
    ]
  }'
```

## Example response

```json theme={null}
{
  "success": true,
  "requestId": "0190a2b4-18a7-7de0-9a43-69b7cf261201",
  "data": {
    "id": "018f1f2e-7b42-7c9a-8d3e-1a2b3c4d5e6f",
    "status": "pending",
    "method": "pix",
    "amount": 1500,
    "base_price": 1500,
    "currency": "BRL",
    "pix": {
      "qr_code": "000201010212...",
      "expiration_date": "2026-03-16T14:15:00.000Z",
      "receipt_url": null
    },
    "created_at": "2026-03-16T14:00:00.000Z",
    "updated_at": "2026-03-16T14:00:00.000Z",
    "paid_at": null
  }
}
```

## Common error

Status `422`

```json theme={null}
{
  "type": "https://api.pagou.ai/problems/validation-error",
  "title": "Validation Error",
  "status": 422,
  "detail": "The request contains invalid data.",
  "errors": [
    {
      "field": "buyer.document.number",
      "message": "Invalid document number",
      "code": "invalid_string"
    }
  ]
}
```

Fix: validate buyer data before calling Pagou. Do not treat `pending` as final. The payment is only settled after a terminal status such as `paid`.

## What your frontend should receive

Return only the buyer-facing Pix data your frontend needs, such as:

* transaction `id`
* current `status`
* `pix.qr_code`
* `pix.expiration_date`

## Next steps

* [Pix Refunds](/payments/pix/refunds)
* [Pix Reconciliation](/payments/pix/reconciliation)
* [Payment Events](/webhooks/payment-events)
