Skip to main content

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.

Copy this prompt into any AI coding agent:
Pagou AI Context
Integrate Pagou payments. Docs: https://developer.pagou.ai/llms.txt | Full: https://developer.pagou.ai/llms-full.txt | OpenAPI: https://developer.pagou.ai/api-reference/openapi-v2.json

Rules:
- Validate endpoints/fields against OpenAPI before coding
- Include external_ref on all create requests
- Card tokenization: Payment Element + elements.submit()
- Fulfill only from webhook or reconciled state
- Deduplicate webhooks by top-level event id

Docs reference

Fast routing

llms.txt — find the right page quickly

Full context

llms-full.txt — complete offline docs

Schema truth

OpenAPI — endpoints, fields, webhooks

Setup by agent

Add to CLAUDE.md in project root:
## Pagou Integration
- Docs: https://developer.pagou.ai/llms.txt
- OpenAPI: https://developer.pagou.ai/api-reference/openapi-v2.json
- Always include external_ref, validate fields against OpenAPI, fulfill only from webhook
Full CLAUDE.md template

One-shot prompts

Copy any of these directly into your AI agent:
Read https://developer.pagou.ai/llms-full.txt and https://developer.pagou.ai/api-reference/openapi-v2.json

Build a Pix checkout flow:
1. Backend: POST /v2/transactions with method=pix, include external_ref
2. Frontend: display pix_qr_code as QR image, show pix_code as copy-paste fallback
3. Webhook: listen for transaction.paid, update order status
4. Handle expiration: check status via GET /v2/transactions/{id} if no webhook

Use env var for API key. Never expose credentials in frontend.
Read https://developer.pagou.ai/llms-full.txt and https://developer.pagou.ai/api-reference/openapi-v2.json

Build a card checkout flow:
1. Frontend: load Payment Element from https://js.pagou.ai/payments/v3.js, mount card form
2. On submit: call elements.submit() to tokenize, send token to backend
3. Backend: POST /v2/transactions with method=credit_card, token, installments, external_ref
4. Handle 3DS: if response has next_action, redirect user to complete authentication
5. Webhook: listen for transaction.paid or transaction.failed, update order status

Use env var for API key. Never handle raw card numbers.
Read https://developer.pagou.ai/llms-full.txt and https://developer.pagou.ai/api-reference/openapi-v2.json

Build a webhook endpoint:
1. POST /webhooks/pagou - accept JSON body
2. Deduplicate by top-level "id" field (same event can be sent multiple times)
3. Route payment events by data.event_type: transaction.paid, transaction.failed, transaction.refunded
4. Route transfer events by type: payout.transferred, payout.failed
5. Return 200 with {"received": true}
6. Process async - respond fast, handle business logic in background

Store processed event IDs to prevent duplicate processing.
Read https://developer.pagou.ai/llms-full.txt and https://developer.pagou.ai/api-reference/openapi-v2.json

Build a Pix Out transfer flow:
1. Backend: POST /v2/transfers with pix_key_type (CPF/CNPJ/EMAIL/PHONE/EVP), pix_key_value, amount, external_ref
2. Webhook: listen for payout.transferred (success) or payout.failed (error)
3. Status check: GET /v2/transfers/{id} if webhook not received
4. Cancellation: POST /v2/transfers/{id}/cancel (only works if status is pending)

Use env var for API key. Validate recipient Pix key before sending.

Tips for agents

Security

  • Keep API keys server-side only, use env vars
  • Never log card tokens or Pix keys
  • Validate webhook source before processing
  • Use HTTPS everywhere

Building

  • Test in sandbox first, same code works in prod
  • Use ngrok to receive webhooks locally
  • Always send external_ref for idempotency
  • Reconcile with GET if webhook fails