Skip to main content
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.
  • 3D Secure handoff uses next_action in the same flow.
  • Your backend contract stays simple: create a transaction with the token returned by the browser.

Backend request

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

{
  "success": true,
  "requestId": "req_1301",
  "data": {
    "id": "tr_2001",
    "status": "three_ds_required",
    "method": "credit_card",
    "amount": 2490,
    "base_price": 2490,
    "currency": "BRL",
    "next_action": {
      "type": "three_ds_challenge",
      "challenge_session_id": "3ds_1001",
      "client_secret": "sec_1001",
      "expires_at": "2026-03-16T14:20:00.000Z"
    },
    "created_at": "2026-03-16T14:00:00.000Z",
    "updated_at": "2026-03-16T14:00:00.000Z",
    "paid_at": null
  }
}

Common error

Status 422
{
  "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