Technical Playbook

PIX PSP Receiver API

Technical guide to implement functional tests, security, performance and monitoring for PIX PSP Receiver APIs — in compliance with BACEN.

Zeroregression incidents
< 15 minfeedback per change
100%critical flows coverage
Talk to expert
01

Scope and Requirements

APIs covered, mTLS/OAuth 2.0 requirements, and applicable BACEN regulations.

APIs Covered in this Playbook

ResourceEndpointDescription
Immediate Charge/cob e /cob/{txid}CRUD for immediate charges with QR Code
Due-Date Charge/cobv e /cobv/{txid}Charges with due date (boleto PIX)
Received PIX/pix e /pix/{e2eid}Query and refund of received PIX payments
Webhook/webhook/{chave}Push notification configuration
Location (Payload)/loc e /loc/{id}QR Code payload management
Automatic PIX (Rec)/rec e /rec/{idRec}Recurring payment management (automatic debit)
CobV Batch/lotecobv/{id}Creation and management of due-date charge batches
Recurring Request/solicrec/{idSolicRec}Recurring authorization confirmation

PIX API v2.9.0 — Security Requirements

  • mTLS required: ICP-Brasil certificate (production) or PSP-issued (staging)
  • OAuth 2.0 Client Credentials: Specific scopes per resource (cob.read, cob.write, pix.read)
  • RFC 8705: Token bound to TLS certificate — prevents token use on another connection

Applicable Regulations

RegulationScope of Application
BCB Resolution No. 1/2020Base regulation for the PIX arrangement
PIX Security ManualTechnical security requirements
PIX API ManualTechnical API specifications
Joint Resolution No. 6/2023Sharing of fraud indicators
BCB Circular No. 3,978/2020Anti-money laundering prevention
LGPD (Law 13,709/2018)Personal data protection

Maintain a mapping between each regulation and the corresponding test cases to facilitate audits.

02

Functional Tests

Test case matrix for /cob, /cobv, /pix and /webhook with P0/P1 prioritization.

Immediate Charge (/cob)

MethodPriorityTest CaseValidations
POST /cob/{txid}P0Create charge with fixed amountHTTP 201, txid, location, QR Code
POST /cob/{txid}P0Create Pix Withdrawal chargemodalidadeAlteracao, retirada
POST /cob/{txid}P1Create Pix Change chargevalor.original, valor.troco
GET /cob/{txid}P0Query existing chargestatus, calendario, valor, chave
PATCH /cob/{txid}P1Revise charge (change status)status REMOVIDA_PELO_USUARIO
GET /cobP1List charges with paginationparametros.paginacao, filtros

Received PIX (/pix)

MethodPriorityTest CaseValidations
GET /pix/{e2eid}P0Query PIX by endToEndIde2eid, txid, valor, horario
PUT /pix/{e2eid}/devolucao/{id}P0Request refund (MD06)rtrId, status, motivo
GET /pix/{e2eid}/devolucao/{id}P1Query refund statusstatus, horario, motivo
GET /pixP1List PIX by periodinicio, fim, paginacao

Prioritize P0 for the first test cycle. P1 can be implemented in parallel or in the second iteration.

03

Security Tests

OWASP API Top 10, OAuth/mTLS validation, and injection vectors for financial APIs.

OWASP API Security Top 10

IDVulnerabilitySpecific Tests
API1:2023Broken Object Level AuthorizationTry to access /cob/{txid} from another user; Manipulate e2eid to query another user's PIX
API2:2023Broken AuthenticationTest expired, revoked, scopeless tokens; Validate mTLS certificate binding
API3:2023Broken Object Property Level AuthorizationMass Assignment: try to alter readonly fields like status, horario; Check if response exposes sensitive data
API4:2023Unrestricted Resource ConsumptionValidate rate limiting; Test 15s timeout; DoS with parallel requests
API5:2023Broken Function Level AuthorizationAccess administrative endpoints; Test privilege escalation in OAuth scopes
API6:2023Unrestricted Access to Sensitive Business FlowsAutomation of mass charge creation; Refund abuse
API7:2023Server-Side Request Forgery (SSRF)Test webhookUrl with internal/localhost addresses; Validate URL sanitization
API8:2023Security MisconfigurationSecurity headers (HSTS, CSP); Verify error handling does not expose stack traces
API9:2023Improper Inventory ManagementMap undocumented endpoints; Verify old API versions are not exposed
API10:2023Unsafe Consumption of APIsValidate DICT integration; Test malformed partner responses

OAuth 2.0 + mTLS Validation

ScenarioResultValidation
Valid token + correct certificate200 OKRequest processed normally
Valid token + different certificate401cnf claim does not match the certificate
Expired token401TokenExpirado
Token without required scope403AcessoNegado - insufficient scope
Expired certificateTLS FailureHandshake fails before request
Revoked certificate (CRL/OCSP)TLS FailureVerify revocation validation
Self-signed certificateTLS FailureNot accepted per regulation
Token with incorrect audience401TokenInvalido

Webhook Security

  • SSRF: Block internal URLs (localhost, 127.0.0.1, private ranges)
  • DNS Rebinding: Resolve DNS only once before connecting
  • Protocol Validation: Accept only https://, reject file://, gopher://

Manually validating mTLS certificates, OAuth scopes, and rate limiting on every deploy does not scale. Automated DAST in the pipeline detects vulnerabilities before they reach production.

Voidr runs DAST, validates OpenAPI specs, and centralizes results in a single dashboard.

Ver como funciona: Segurança & Compliance
04

Synthetic Monitoring

Monitoring scenarios, regulatory SLAs, and alert configuration.

Recommended Monitoring Scenarios

ScenarioFrequencySLAAlerts
OAuth Health Check1 min< 500msPagerDuty P1, Slack #alerts
Token Refresh Flow5 min< 1000msSlack, Grafana
Create + Query Cob5 min< 2000msEmail, Slack, Grafana
Webhook Delivery5 min< 5000msPagerDuty P1
DICT Query5 min< 1500msSlack, Datadog
E2E Payment Flow15 min< 10000msAll channels

Regulatory SLAs (PIX Security Manual)

  • Availability: Minimum 99.5% monthly per endpoint
  • Timeout: Maximum 15 seconds for synchronous operations
  • Maintenance window: Prior communication to BACEN required

Configure alerts on multiple channels (Slack, PagerDuty, email) to ensure rapid incident response.

05

Performance Tests

Load profiles (smoke, load, stress, soak), traffic distribution and acceptance criteria.

Load Profiles

TypeVUsDurationObjective
Smoke Test1-51 minValidate scripts and test environment
Load Test100-50030 minNormal production load
Stress Test500-200015 minFind breaking point
Spike Test0→1000→010 minSudden spikes (flash sale, payroll day)
Soak Test200-3004-8 hoursMemory leaks, gradual degradation
Breakpoint TestRamp upUntil failureAbsolute maximum capacity

Realistic Traffic Distribution

EndpointTrafficThink TimePacing
POST /cob/{txid} (create charge)40%1-3sRandom
GET /cob/{txid} (query charge)35%0.5-1sConstant
GET /pix (list received)15%2-5sRandom
PUT /pix/{e2eid}/devolucao (refund)8%5-10sRandom
Webhook callbacks (simulated)2%N/AAsync

Acceptance Criteria

Error Rate < 1%
P95 Latency < 2s
Throughput ≥ 500 TPS
Recovery < 60s
CPU/Memory < 80%

Run Soak Tests (4h+) regularly to detect memory leaks and gradual degradation that do not appear in short tests.

06

Service Virtualization

Mock server for BACEN APIs, stateful stubs and fault injection.

Test Environment Architecture

┌─────────────────────────────────────────────────────────────────┐
│                    Ambiente de Testes Isolado                   │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  ┌─────────┐     ┌─────────────────┐     ┌─────────────────┐   │
│  │  Testes │────▶│  Mock Server    │────▶│  Webhook        │   │
│  │  E2E    │     │  (API BACEN)    │     │  Simulator      │   │
│  └─────────┘     └─────────────────┘     └─────────────────┘   │
│       │                  │                       │              │
│       │          ┌───────┴───────┐               │              │
│       │          ▼               ▼               │              │
│       │    ┌──────────┐   ┌──────────┐           │              │
│       │    │ Stateful │   │  Fault   │           │              │
│       │    │ Stubs    │   │ Injection│           │              │
│       │    └──────────┘   └──────────┘           │              │
│       │                                          │              │
│       └──────────────────────────────────────────┘              │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘
          
Virtualization allows testing without dependency on the real BACEN environment

Simulation Scenarios

ScenarioBehaviorUse Case
Happy PathStandard 2xx responsesAgile development, basic tests
Timeout SimulationDelay 16s → 504 Gateway TimeoutResilience and circuit breaker testing
Rate Limiting429 after N requests/minValidate exponential backoff/retry
Partial Failure50% random errorsChaos engineering, fallback logic
Webhook DelayCallback after 30minPolling vs push, reconciliation
Certificate ErrorSimulated mTLS failureCertificate error handling

Stateful mocks allow simulating complete flows (create charge → receive payment → process webhook) without real integration.

07

Synthetic Data

Generation of valid txid, e2eid, CPF/CNPJ without real data (LGPD).

Fields and Generation Rules

FieldTypeRule
txidString [26-35][a-zA-Z0-9]{26,35} unique per receiver CNPJ
endToEndId (e2eid)String [32]E + ISPB(8) + DATE(8) + SEQ(11) + CTRL(5)
chave (CPF)String [11]Valid CPF with correct check digit
chave (CNPJ)String [14]Valid CNPJ with correct check digit
chave (Email)String [max 77]user{uuid}@testdomain.pix.test
chave (Phone)String [14]+5511999{random(6)} - E.164 format
valor.originalDecimal [16,2]Random 0.01-999999.99 (log-normal distribution)
devedor.nomeString [max 200]Faker.name() locale pt-BR
Example: PIX Data Generationtypescript
import { faker } from '@faker-js/faker/locale/pt_BR';

// txid: 26-35 caracteres alfanuméricos
const txid = faker.string.alphanumeric({ length: 32 });

// CPF válido com dígito verificador
const cpf = generateValidCPF();

// endToEndId no formato BACEN
const e2eid = `E${ispb}${dateStr}${seq}${ctrl}`;

// Valor com distribuição realista
const valor = faker.finance.amount({ min: 0.01, max: 999999.99 });

LGPD Compliance

  • Zero real data: Synthetic data contains no PII from real individuals
  • Non-reversibility: Impossible to reconstruct original data from synthetic data
  • Full isolation: Test environments fully segregated from production
08

CI/CD Pipeline

Quality gates per stage: linting, contract tests, DAST, load tests.

Quality Pipeline

┌──────────┐   ┌──────────┐   ┌─────────────┐   ┌──────────┐   ┌────────────┐
│ Pre-     │──▶│  Build   │──▶│ Integration │──▶│ Staging  │──▶│ Production │
│ commit   │   │          │   │             │   │          │   │            │
└──────────┘   └──────────┘   └─────────────┘   └──────────┘   └────────────┘
     │              │               │                │               │
     ▼              ▼               ▼                ▼               ▼
 ┌────────┐   ┌──────────┐   ┌───────────┐   ┌──────────┐   ┌────────────┐
 │Linting │   │ Unit     │   │ Smoke     │   │Regressivo│   │ Canary     │
 │OpenAPI │   │ Contract │   │ Tests     │   │ Security │   │ Monitoring │
 │ Schema │   │ Tests    │   │ E2E       │   │ Load     │   │ Sintético  │
 └────────┘   └──────────┘   └───────────┘   └──────────┘   └────────────┘
          
Quality gates at each stage prevent regressions in production
GitHub Actions: Pipeline PIXyaml
name: PIX API Quality Gates
on: [push, pull_request]

jobs:
  quality:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Validate OpenAPI Schema
        run: npx @stoplight/spectral lint openapi.yaml

      - name: Contract Tests
        run: npx prism proxy openapi.yaml --errors

      - name: Functional Tests
        run: npm run test:pix-api

      - name: Security Scan (OWASP)
        run: npm run security:scan

      - name: Performance Baseline
        run: npm run perf:smoke

Orchestrating contract testing, DAST, and load testing in separate pipelines creates maintenance overhead and fragmented results across tools.

Voidr runs all quality gates in a single workflow and reports consolidated results per PR.

Ver como funciona: Automação de Testes
09

Checklist

Verification list for infrastructure, tests, security and compliance.

Infrastructure

0/6

Functional Tests

0/6

Security Tests

0/7

Performance

0/5

Data & Compliance

0/5

Use this checklist as an implementation guide. Progress is automatically saved in your browser.

10

Next Step

Automate PIX API testing and monitoring with AI

Voidr
AI Agent

AI Agent for PIX APIs

Generates test cases from the OpenAPI spec, runs on every PR, and automatically updates tests when the API changes. Runs in your cloud.

Generation from OpenAPI
Automatic test updates
Execution on every PR
Schedule a demo

What does
a production failure cost?

1h diagnostic. We map your
critical journeys and show what is uncovered.

Book a demo