> ## 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.

# Payment Element for Cards

> Understand why Payment Element is the default card integration and how it connects to the transactions API.

Use Payment Element when you are building or rebuilding checkout.

## Why Pagou recommends it

* Hosted card fields reduce PCI exposure.
* Tokenization happens in the browser without your backend touching raw card data.
* Card authentication is handled inside `elements.submit(...)`, with no extra fields to collect.
* Your backend contract stays simple: create a transaction with the token returned by the browser.

## Backend 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_2001",
    "amount": 2490,
    "currency": "BRL",
    "method": "credit_card",
    "token": "pgct_token_from_browser",
    "installments": 1,
    "buyer": {
      "name": "Ada Lovelace",
      "email": "ada@example.com",
      "document": {
        "type": "CPF",
        "number": "12345678901"
      }
    },
    "products": [
      {
        "name": "Plan upgrade",
        "price": 2490,
        "quantity": 1
      }
    ]
  }'
```

## Example response

```json theme={null}
{
  "success": true,
  "requestId": "0190a2b4-18a7-7de0-9a43-69b7cf261201",
  "data": {
    "id": "018f1f2e-7b43-7c9a-8d3e-1a2b3c4d5e70",
    "status": "three_ds_required",
    "method": "credit_card",
    "amount": 2490,
    "base_price": 2490,
    "currency": "BRL",
    "next_action": {
      "type": "three_ds_challenge"
    },
    "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": "token",
      "message": "Token is required for credit card payments",
      "code": "invalid_type"
    }
  ]
}
```

Fix: create the token in Payment Element first. Do not collect raw card data in your own form and send it directly to the API.

## Decision rule

* Use Payment Element for new browser card flows.
* Keep older tokenization only when you are maintaining a legacy flow and cannot migrate yet.

## Continue with

* [Frontend Quickstart](/frontend/payment-element/quickstart)
* [Accept a Payment](/frontend/payment-element/accept-a-payment)
* [Migration from WebSDK](/frontend/payment-element/migration-from-websdk)
