{
  "info": {
    "_postman_id": "23da9fa7-5a38-5c16-8aac-89a93c52be53",
    "name": "API de Integração Bancastro — PIX e Boleto",
    "description": "API da Bancastro: pagamentos e recebimentos via PIX e boleto (base: https://api.bancastro.com.br). Documento completo: API-EXTERNA.pdf.\n\nValores na requisição em REAIS (exceto emissão de boleto: centavos). Valores na resposta em CENTAVOS (+ `_brl` em reais).\n\n**Autenticação — duas formas:**\n1. **Chave de API (padrão, recomendada):** preencha `apiKey` no ambiente (chave `wlk_...` emitida pela Bancastro). Todos os requests já enviam o header `x-api-key`. Saídas de dinheiro (`/pix/withdraw`, `/pix/pay-code`, `/boleto/pay`) não exigem 2FA por chave: o campo `code` é ignorado. A chave sozinha movimenta dinheiro: guarde-a em cofre.\n2. **Login:** rode **Login** (ou Login 2FA) — o token é salvo em `{{token}}` — e troque o header ativo (ative `x-access-token`, desative `x-api-key`). Se os dois forem enviados, vale o token.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "item": [
    {
      "name": "1. Autenticação",
      "description": "Alternativa à chave de API: login do correntista. O token vai no header `x-access-token` (validade ~63 min, sem refresh). Para usar, ative `x-access-token` e desative `x-api-key` nos requests.",
      "item": [
        {
          "name": "Login",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/login",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "login"
              ]
            },
            "description": "Autentica com usuário e senha. Sem 2FA: devolve o token (salvo em {{token}}). Com 2FA: siga para Login 2FA.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"user\": \"{{user}}\",\n  \"password\": \"{{password}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const j = pm.response.json();",
                  "if (j['x-access-token']) {",
                  "  pm.collectionVariables.set('token', j['x-access-token']);",
                  "  console.log('token salvo');",
                  "} else if (j.A2fa_Ativada || j.required_2fa) {",
                  "  console.log('2FA necessario: use o request Login 2FA');",
                  "}"
                ]
              }
            }
          ],
          "response": [
            {
              "name": "200 OK",
              "originalRequest": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{baseUrl}}/login",
                  "host": [
                    "{{baseUrl}}"
                  ],
                  "path": [
                    "login"
                  ]
                },
                "description": "Autentica com usuário e senha. Sem 2FA: devolve o token (salvo em {{token}}). Com 2FA: siga para Login 2FA.",
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"user\": \"{{user}}\",\n  \"password\": \"{{password}}\"\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                }
              },
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "body": "{\n  \"status\": \"login  efetuado com sucesso!\",\n  \"x-access-token\": \"eyJhbGciOi...\",\n  \"email\": \"financeiro@empresa.com\",\n  \"role\": \"user\",\n  \"name\": \"Empresa X LTDA\",\n  \"cpfCnpj\": \"12345678000199\",\n  \"A2fa_Ativada\": false,\n  \"required_2fa\": false\n}"
            }
          ]
        },
        {
          "name": "Login 2FA",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/login2fa",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "login2fa"
              ]
            },
            "description": "Conclui o login de usuário com 2FA. `code` = TOTP de 6 dígitos do app autenticador.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"user\": \"{{user}}\",\n  \"password\": \"{{password}}\",\n  \"code\": \"{{totp}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const j = pm.response.json();",
                  "if (j['x-access-token']) {",
                  "  pm.collectionVariables.set('token', j['x-access-token']);",
                  "  console.log('token salvo');",
                  "} else if (j.A2fa_Ativada || j.required_2fa) {",
                  "  console.log('2FA necessario: use o request Login 2FA');",
                  "}"
                ]
              }
            }
          ]
        }
      ]
    },
    {
      "name": "2. Conta e extrato",
      "item": [
        {
          "name": "Saldo da Conta Corrente",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{apiKey}}",
                "type": "text",
                "description": "Chave de API emitida pela Bancastro (recomendada)"
              },
              {
                "key": "x-access-token",
                "value": "{{token}}",
                "type": "text",
                "disabled": true,
                "description": "Alternativa: token do Login. Se enviado junto, vale o token e a chave é ignorada"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/me/account",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "me",
                "account"
              ]
            },
            "description": "Saldos em centavos (`*_balance`) e em reais (`*_balance_brl`)."
          },
          "response": [
            {
              "name": "200 OK",
              "originalRequest": {
                "method": "GET",
                "header": [
                  {
                    "key": "x-api-key",
                    "value": "{{apiKey}}",
                    "type": "text",
                    "description": "Chave de API emitida pela Bancastro (recomendada)"
                  },
                  {
                    "key": "x-access-token",
                    "value": "{{token}}",
                    "type": "text",
                    "disabled": true,
                    "description": "Alternativa: token do Login. Se enviado junto, vale o token e a chave é ignorada"
                  }
                ],
                "url": {
                  "raw": "{{baseUrl}}/me/account",
                  "host": [
                    "{{baseUrl}}"
                  ],
                  "path": [
                    "me",
                    "account"
                  ]
                },
                "description": "Saldos em centavos (`*_balance`) e em reais (`*_balance_brl`)."
              },
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "body": "{\n  \"sub_account_id\": 1024,\n  \"status\": \"ACTIVE\",\n  \"nome\": \"Empresa X LTDA\",\n  \"cpf_cnpj\": \"12345678000199\",\n  \"available_balance\": 150000,\n  \"reserved_balance\": 2500,\n  \"total_balance\": 152500,\n  \"available_balance_brl\": 1500.00,\n  \"reserved_balance_brl\": 25.00,\n  \"total_balance_brl\": 1525.00\n}"
            }
          ]
        },
        {
          "name": "Contas do correntista",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{apiKey}}",
                "type": "text",
                "description": "Chave de API emitida pela Bancastro (recomendada)"
              },
              {
                "key": "x-access-token",
                "value": "{{token}}",
                "type": "text",
                "disabled": true,
                "description": "Alternativa: token do Login. Se enviado junto, vale o token e a chave é ignorada"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/me/accounts",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "me",
                "accounts"
              ]
            },
            "description": "Lista Conta Corrente (e Conta Pagamento, se multiconta) com capacidades."
          }
        },
        {
          "name": "Extrato",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{apiKey}}",
                "type": "text",
                "description": "Chave de API emitida pela Bancastro (recomendada)"
              },
              {
                "key": "x-access-token",
                "value": "{{token}}",
                "type": "text",
                "disabled": true,
                "description": "Alternativa: token do Login. Se enviado junto, vale o token e a chave é ignorada"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/me/transactions?page=1&page_size=20",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "me",
                "transactions"
              ],
              "query": [
                {
                  "key": "page",
                  "value": "1",
                  "disabled": false,
                  "description": "padrão 1"
                },
                {
                  "key": "page_size",
                  "value": "20",
                  "disabled": false,
                  "description": "padrão 20, máx 100"
                },
                {
                  "key": "from",
                  "value": "2026-11-01",
                  "disabled": true,
                  "description": "YYYY-MM-DD ou ISO"
                },
                {
                  "key": "to",
                  "value": "2026-11-30",
                  "disabled": true,
                  "description": "YYYY-MM-DD ou ISO"
                },
                {
                  "key": "type",
                  "value": "CASH_IN",
                  "disabled": true,
                  "description": "CASH_IN, CASH_OUT, RESERVE, RELEASE, SETTLEMENT, REVERSAL, ADJUSTMENT, FEE, OPENING_BALANCE, MIGRATION"
                }
              ]
            },
            "description": "Extrato paginado da Conta Corrente."
          }
        }
      ]
    },
    {
      "name": "3. Recebimento PIX",
      "item": [
        {
          "name": "Criar cobrança PIX",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{apiKey}}",
                "type": "text",
                "description": "Chave de API emitida pela Bancastro (recomendada)"
              },
              {
                "key": "x-access-token",
                "value": "{{token}}",
                "type": "text",
                "disabled": true,
                "description": "Alternativa: token do Login. Se enviado junto, vale o token e a chave é ignorada"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/pix/charge",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "pix",
                "charge"
              ]
            },
            "description": "Gera QR Code / copia-e-cola. `amount` em REAIS. Resposta em centavos.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"amount\": 50.00,\n  \"description\": \"Pedido 9981\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const j = pm.response.json();",
                  "if (j && j.id) pm.collectionVariables.set('chargeId', j.id);"
                ]
              }
            }
          ],
          "response": [
            {
              "name": "201 Created",
              "originalRequest": {
                "method": "POST",
                "header": [
                  {
                    "key": "x-api-key",
                    "value": "{{apiKey}}",
                    "type": "text",
                    "description": "Chave de API emitida pela Bancastro (recomendada)"
                  },
                  {
                    "key": "x-access-token",
                    "value": "{{token}}",
                    "type": "text",
                    "disabled": true,
                    "description": "Alternativa: token do Login. Se enviado junto, vale o token e a chave é ignorada"
                  },
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{baseUrl}}/pix/charge",
                  "host": [
                    "{{baseUrl}}"
                  ],
                  "path": [
                    "pix",
                    "charge"
                  ]
                },
                "description": "Gera QR Code / copia-e-cola. `amount` em REAIS. Resposta em centavos.",
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"amount\": 50.00,\n  \"description\": \"Pedido 9981\"\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                }
              },
              "status": "Created",
              "code": 201,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "body": "{\n  \"id\": 3021,\n  \"txid\": \"a8f3c2...\",\n  \"emv\": \"00020101021226...6304ABCD\",\n  \"image_base64\": \"iVBORw0KGgo...\",\n  \"amount\": 5000,\n  \"status\": \"PENDING\",\n  \"expires_at\": \"2026-11-12T14:03:00.000Z\"\n}"
            }
          ]
        },
        {
          "name": "Consultar cobrança PIX",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{apiKey}}",
                "type": "text",
                "description": "Chave de API emitida pela Bancastro (recomendada)"
              },
              {
                "key": "x-access-token",
                "value": "{{token}}",
                "type": "text",
                "disabled": true,
                "description": "Alternativa: token do Login. Se enviado junto, vale o token e a chave é ignorada"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/pix/charge/{{chargeId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "pix",
                "charge",
                "{{chargeId}}"
              ]
            },
            "description": "Status: PENDING, PAID, EXPIRED, FAILED. Faça polling até sair de PENDING."
          }
        }
      ]
    },
    {
      "name": "4. Pagamento PIX",
      "item": [
        {
          "name": "Consultar chave PIX (DICT)",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{apiKey}}",
                "type": "text",
                "description": "Chave de API emitida pela Bancastro (recomendada)"
              },
              {
                "key": "x-access-token",
                "value": "{{token}}",
                "type": "text",
                "disabled": true,
                "description": "Alternativa: token do Login. Se enviado junto, vale o token e a chave é ignorada"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/pix/consultar/{{pixKey}}/{{pixKeyLookupType}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "pix",
                "consultar",
                "{{pixKey}}",
                "{{pixKeyLookupType}}"
              ]
            },
            "description": "Tipos aceitos aqui: CPF, CNPJ, EMAIL, TELEFONE, CHAVE_ALEATORIA. Guarde o end2end_id para o saque. 404 = chave inexistente."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const j = pm.response.json();",
                  "if (j && j.end2end_id) pm.collectionVariables.set('end2endId', j.end2end_id);"
                ]
              }
            }
          ]
        },
        {
          "name": "Transferir para chave PIX",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{apiKey}}",
                "type": "text",
                "description": "Chave de API emitida pela Bancastro (recomendada)"
              },
              {
                "key": "x-access-token",
                "value": "{{token}}",
                "type": "text",
                "disabled": true,
                "description": "Alternativa: token do Login. Se enviado junto, vale o token e a chave é ignorada"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              },
              {
                "key": "Idempotency-Key",
                "value": "{{$guid}}",
                "type": "text",
                "disabled": true,
                "description": "Alternativa ao idempotency_key do corpo"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/pix/withdraw",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "pix",
                "withdraw"
              ]
            },
            "description": "`amount` em REAIS. `pix_key_type`: CPF, CNPJ, EMAIL, PHONE, EVP. `code` = TOTP, só para acesso por login; ignorado por chave de API. Limite: 20 saídas/5 min (429). 202 = aceito; 200 + duplicate=true = reenvio idempotente.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"amount\": 120.00,\n  \"pix_key\": \"{{pixKey}}\",\n  \"pix_key_type\": \"EMAIL\",\n  \"end2end_id\": \"{{end2endId}}\",\n  \"code\": \"{{totp}}\",\n  \"idempotency_key\": \"{{$guid}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const j = pm.response.json();",
                  "if (j && j.id) pm.collectionVariables.set('payoutId', j.id);"
                ]
              }
            }
          ],
          "response": [
            {
              "name": "202 Accepted",
              "originalRequest": {
                "method": "POST",
                "header": [
                  {
                    "key": "x-api-key",
                    "value": "{{apiKey}}",
                    "type": "text",
                    "description": "Chave de API emitida pela Bancastro (recomendada)"
                  },
                  {
                    "key": "x-access-token",
                    "value": "{{token}}",
                    "type": "text",
                    "disabled": true,
                    "description": "Alternativa: token do Login. Se enviado junto, vale o token e a chave é ignorada"
                  },
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  },
                  {
                    "key": "Idempotency-Key",
                    "value": "{{$guid}}",
                    "type": "text",
                    "disabled": true,
                    "description": "Alternativa ao idempotency_key do corpo"
                  }
                ],
                "url": {
                  "raw": "{{baseUrl}}/pix/withdraw",
                  "host": [
                    "{{baseUrl}}"
                  ],
                  "path": [
                    "pix",
                    "withdraw"
                  ]
                },
                "description": "`amount` em REAIS. `pix_key_type`: CPF, CNPJ, EMAIL, PHONE, EVP. `code` = TOTP, só para acesso por login; ignorado por chave de API. Limite: 20 saídas/5 min (429). 202 = aceito; 200 + duplicate=true = reenvio idempotente.",
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"amount\": 120.00,\n  \"pix_key\": \"{{pixKey}}\",\n  \"pix_key_type\": \"EMAIL\",\n  \"end2end_id\": \"{{end2endId}}\",\n  \"code\": \"{{totp}}\",\n  \"idempotency_key\": \"{{$guid}}\"\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                }
              },
              "status": "Accepted",
              "code": 202,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "body": "{\n  \"id\": 7781,\n  \"status\": \"RESERVED\",\n  \"duplicate\": false\n}"
            }
          ]
        },
        {
          "name": "Consultar saída",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{apiKey}}",
                "type": "text",
                "description": "Chave de API emitida pela Bancastro (recomendada)"
              },
              {
                "key": "x-access-token",
                "value": "{{token}}",
                "type": "text",
                "disabled": true,
                "description": "Alternativa: token do Login. Se enviado junto, vale o token e a chave é ignorada"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/pix/withdraw/{{payoutId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "pix",
                "withdraw",
                "{{payoutId}}"
              ]
            },
            "description": "Vale para PIX chave, copia-e-cola e boleto. Status: REQUESTED, RESERVED, PROCESSING, SUCCESS, FAILED, CANCELED."
          }
        },
        {
          "name": "Comprovante da saída",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{apiKey}}",
                "type": "text",
                "description": "Chave de API emitida pela Bancastro (recomendada)"
              },
              {
                "key": "x-access-token",
                "value": "{{token}}",
                "type": "text",
                "disabled": true,
                "description": "Alternativa: token do Login. Se enviado junto, vale o token e a chave é ignorada"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/pix/withdraw/{{payoutId}}/comprovante",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "pix",
                "withdraw",
                "{{payoutId}}",
                "comprovante"
              ]
            },
            "description": "Só após SUCCESS (antes: 409)."
          }
        },
        {
          "name": "Ler PIX copia-e-cola (preview)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{apiKey}}",
                "type": "text",
                "description": "Chave de API emitida pela Bancastro (recomendada)"
              },
              {
                "key": "x-access-token",
                "value": "{{token}}",
                "type": "text",
                "disabled": true,
                "description": "Alternativa: token do Login. Se enviado junto, vale o token e a chave é ignorada"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/pix/pay-code/preview",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "pix",
                "pay-code",
                "preview"
              ]
            },
            "description": "Lê valor e destinatário sem movimentar saldo.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"emv\": \"{{emv}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "response": [
            {
              "name": "200 OK",
              "originalRequest": {
                "method": "POST",
                "header": [
                  {
                    "key": "x-api-key",
                    "value": "{{apiKey}}",
                    "type": "text",
                    "description": "Chave de API emitida pela Bancastro (recomendada)"
                  },
                  {
                    "key": "x-access-token",
                    "value": "{{token}}",
                    "type": "text",
                    "disabled": true,
                    "description": "Alternativa: token do Login. Se enviado junto, vale o token e a chave é ignorada"
                  },
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{baseUrl}}/pix/pay-code/preview",
                  "host": [
                    "{{baseUrl}}"
                  ],
                  "path": [
                    "pix",
                    "pay-code",
                    "preview"
                  ]
                },
                "description": "Lê valor e destinatário sem movimentar saldo.",
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"emv\": \"{{emv}}\"\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                }
              },
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "body": "{\n  \"amount\": 4990,\n  \"amount_brl\": 49.90,\n  \"fixed_amount\": true,\n  \"receiver_name\": \"Loja Exemplo\",\n  \"pix_key\": \"a1b2c3d4-...\",\n  \"txid\": \"PEDIDO123\"\n}"
            }
          ]
        },
        {
          "name": "Pagar PIX copia-e-cola",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{apiKey}}",
                "type": "text",
                "description": "Chave de API emitida pela Bancastro (recomendada)"
              },
              {
                "key": "x-access-token",
                "value": "{{token}}",
                "type": "text",
                "disabled": true,
                "description": "Alternativa: token do Login. Se enviado junto, vale o token e a chave é ignorada"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              },
              {
                "key": "Idempotency-Key",
                "value": "{{$guid}}",
                "type": "text",
                "disabled": true,
                "description": "Alternativa ao idempotency_key do corpo"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/pix/pay-code",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "pix",
                "pay-code"
              ]
            },
            "description": "`amount` (reais) só é usado em QR de valor aberto. `code`: só para acesso por login; ignorado por chave de API.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"emv\": \"{{emv}}\",\n  \"amount\": 49.90,\n  \"code\": \"{{totp}}\",\n  \"idempotency_key\": \"{{$guid}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const j = pm.response.json();",
                  "if (j && j.id) pm.collectionVariables.set('payoutId', j.id);"
                ]
              }
            }
          ]
        }
      ]
    },
    {
      "name": "5. Boletos",
      "item": [
        {
          "name": "Emitir boleto (recebimento)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{apiKey}}",
                "type": "text",
                "description": "Chave de API emitida pela Bancastro (recomendada)"
              },
              {
                "key": "x-access-token",
                "value": "{{token}}",
                "type": "text",
                "disabled": true,
                "description": "Alternativa: token do Login. Se enviado junto, vale o token e a chave é ignorada"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/boleto",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "boleto"
              ]
            },
            "description": "ATENÇÃO: `amount` em CENTAVOS. Não repita a chamada se emailSent=false (geraria outro boleto). Em 502 não repita às cegas: confira antes Listar boletos emitidos (risco de cobrança em duplicidade). Erros desta rota usam `description` (e `code`/`trace_id` nas recusas do provedor).",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"amount\": 15000,\n  \"due_date\": \"2026-11-30\",\n  \"expiration_date\": \"2026-12-30\",\n  \"payer\": {\n    \"name\": \"Cliente Pagador\",\n    \"tax_id\": \"12345678909\",\n    \"address\": {\n      \"street\": \"Rua Exemplo\",\n      \"number\": \"100\",\n      \"complement\": \"Sala 2\",\n      \"district\": \"Centro\",\n      \"city\": \"São Paulo\",\n      \"state\": \"SP\",\n      \"postal_code\": \"01001000\"\n    }\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "Listar boletos emitidos",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{apiKey}}",
                "type": "text",
                "description": "Chave de API emitida pela Bancastro (recomendada)"
              },
              {
                "key": "x-access-token",
                "value": "{{token}}",
                "type": "text",
                "disabled": true,
                "description": "Alternativa: token do Login. Se enviado junto, vale o token e a chave é ignorada"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/billing/boleto",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "billing",
                "boleto"
              ]
            },
            "description": "Lista de boletos emitidos no provedor."
          }
        },
        {
          "name": "Reenviar boleto por e-mail",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{apiKey}}",
                "type": "text",
                "description": "Chave de API emitida pela Bancastro (recomendada)"
              },
              {
                "key": "x-access-token",
                "value": "{{token}}",
                "type": "text",
                "disabled": true,
                "description": "Alternativa: token do Login. Se enviado junto, vale o token e a chave é ignorada"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/billing/boleto/email/{{boletoId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "billing",
                "boleto",
                "email",
                "{{boletoId}}"
              ]
            },
            "description": "Reenvia o PDF ao e-mail do correntista."
          }
        },
        {
          "name": "Consultar boleto a pagar",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{apiKey}}",
                "type": "text",
                "description": "Chave de API emitida pela Bancastro (recomendada)"
              },
              {
                "key": "x-access-token",
                "value": "{{token}}",
                "type": "text",
                "disabled": true,
                "description": "Alternativa: token do Login. Se enviado junto, vale o token e a chave é ignorada"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/bill/simulate",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "bill",
                "simulate"
              ]
            },
            "description": "Consulta na CIP: valor atualizado, beneficiário e situação.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"linhaDigitavel\": \"{{barcode}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "Pagar boleto",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{apiKey}}",
                "type": "text",
                "description": "Chave de API emitida pela Bancastro (recomendada)"
              },
              {
                "key": "x-access-token",
                "value": "{{token}}",
                "type": "text",
                "disabled": true,
                "description": "Alternativa: token do Login. Se enviado junto, vale o token e a chave é ignorada"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              },
              {
                "key": "Idempotency-Key",
                "value": "{{$guid}}",
                "type": "text",
                "disabled": true,
                "description": "Alternativa ao idempotency_key do corpo"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/boleto/pay",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "boleto",
                "pay"
              ]
            },
            "description": "Valor definido pela CIP (não pelo integrador). `code` (TOTP): só para acesso por login; ignorado por chave de API. Acompanhe em Consultar saída.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"barcode\": \"{{barcode}}\",\n  \"code\": \"{{totp}}\",\n  \"idempotency_key\": \"{{$guid}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const j = pm.response.json();",
                  "if (j && j.id) pm.collectionVariables.set('payoutId', j.id);"
                ]
              }
            }
          ],
          "response": [
            {
              "name": "202 Accepted",
              "originalRequest": {
                "method": "POST",
                "header": [
                  {
                    "key": "x-api-key",
                    "value": "{{apiKey}}",
                    "type": "text",
                    "description": "Chave de API emitida pela Bancastro (recomendada)"
                  },
                  {
                    "key": "x-access-token",
                    "value": "{{token}}",
                    "type": "text",
                    "disabled": true,
                    "description": "Alternativa: token do Login. Se enviado junto, vale o token e a chave é ignorada"
                  },
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  },
                  {
                    "key": "Idempotency-Key",
                    "value": "{{$guid}}",
                    "type": "text",
                    "disabled": true,
                    "description": "Alternativa ao idempotency_key do corpo"
                  }
                ],
                "url": {
                  "raw": "{{baseUrl}}/boleto/pay",
                  "host": [
                    "{{baseUrl}}"
                  ],
                  "path": [
                    "boleto",
                    "pay"
                  ]
                },
                "description": "Valor definido pela CIP (não pelo integrador). `code` (TOTP): só para acesso por login; ignorado por chave de API. Acompanhe em Consultar saída.",
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"barcode\": \"{{barcode}}\",\n  \"code\": \"{{totp}}\",\n  \"idempotency_key\": \"{{$guid}}\"\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                }
              },
              "status": "Accepted",
              "code": 202,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "body": "{\n  \"id\": 7790,\n  \"status\": \"RESERVED\",\n  \"duplicate\": false,\n  \"amount\": 15230,\n  \"amount_brl\": 152.30\n}"
            }
          ]
        },
        {
          "name": "Comprovante de boleto pago",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{apiKey}}",
                "type": "text",
                "description": "Chave de API emitida pela Bancastro (recomendada)"
              },
              {
                "key": "x-access-token",
                "value": "{{token}}",
                "type": "text",
                "disabled": true,
                "description": "Alternativa: token do Login. Se enviado junto, vale o token e a chave é ignorada"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/me/boleto/{{payoutId}}/comprovante",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "me",
                "boleto",
                "{{payoutId}}",
                "comprovante"
              ]
            },
            "description": "Disponível após SUCCESS."
          }
        }
      ]
    }
  ],
  "variable": [
    {
      "key": "token",
      "value": ""
    },
    {
      "key": "chargeId",
      "value": ""
    },
    {
      "key": "payoutId",
      "value": ""
    },
    {
      "key": "end2endId",
      "value": ""
    },
    {
      "key": "boletoId",
      "value": ""
    }
  ]
}