curl --request GET \
--url 'https://api.econpay.com.br/customers?page=1&limit=20' \
--header 'Authorization: Bearer SEU_TOKEN_JWT'
curl --request GET \
--url 'https://api.econpay.com.br/customers?name=João' \
--header 'Authorization: Bearer SEU_TOKEN_JWT'
curl --request GET \
--url 'https://api.econpay.com.br/customers?document=12345678900' \
--header 'Authorization: Bearer SEU_TOKEN_JWT'
const response = await fetch(
'https://api.econpay.com.br/customers?page=1&limit=20',
{
headers: { 'Authorization': `Bearer ${token}` }
}
);
const { data, total, page, lastPage } = await response.json();
console.log(`Mostrando ${data.length} de ${total} clientes`);
data.forEach(customer => {
console.log(`${customer.name} - ${customer.email}`);
});
import requests
response = requests.get(
'https://api.econpay.com.br/customers',
headers={'Authorization': f'Bearer {token}'},
params={
'page': 1,
'limit': 20,
'name': 'João'
}
)
data = response.json()
print(f"Total: {data['total']} clientes")
for customer in data['data']:
print(f"{customer['name']} - {customer['document']}")
<?php
$params = http_build_query([
'page' => 1,
'limit' => 20
]);
$ch = curl_init("https://api.econpay.com.br/customers?{$params}");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer ' . $token
]);
$response = curl_exec($ch);
$data = json_decode($response, true);
echo "Total: {$data['total']} clientes\n";
foreach ($data['data'] as $customer) {
echo "{$customer['name']} - {$customer['email']}\n";
}
curl_close($ch);
?>
{
"data": [
{
"id": 1,
"name": "João da Silva",
"email": "[email protected]",
"document": "12345678900",
"phone": "+55 11 999999999",
"created_at": "2024-01-15T10:30:00Z"
},
{
"id": 2,
"name": "Maria Santos",
"email": "[email protected]",
"document": "98765432100",
"phone": "+55 11 988888888",
"created_at": "2024-01-16T14:20:00Z"
}
],
"total": 150,
"page": 1,
"lastPage": 8
}
Clientes
GET /customers
Listar clientes com paginação e filtros
GET
/
customers
curl --request GET \
--url 'https://api.econpay.com.br/customers?page=1&limit=20' \
--header 'Authorization: Bearer SEU_TOKEN_JWT'
curl --request GET \
--url 'https://api.econpay.com.br/customers?name=João' \
--header 'Authorization: Bearer SEU_TOKEN_JWT'
curl --request GET \
--url 'https://api.econpay.com.br/customers?document=12345678900' \
--header 'Authorization: Bearer SEU_TOKEN_JWT'
const response = await fetch(
'https://api.econpay.com.br/customers?page=1&limit=20',
{
headers: { 'Authorization': `Bearer ${token}` }
}
);
const { data, total, page, lastPage } = await response.json();
console.log(`Mostrando ${data.length} de ${total} clientes`);
data.forEach(customer => {
console.log(`${customer.name} - ${customer.email}`);
});
import requests
response = requests.get(
'https://api.econpay.com.br/customers',
headers={'Authorization': f'Bearer {token}'},
params={
'page': 1,
'limit': 20,
'name': 'João'
}
)
data = response.json()
print(f"Total: {data['total']} clientes")
for customer in data['data']:
print(f"{customer['name']} - {customer['document']}")
<?php
$params = http_build_query([
'page' => 1,
'limit' => 20
]);
$ch = curl_init("https://api.econpay.com.br/customers?{$params}");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer ' . $token
]);
$response = curl_exec($ch);
$data = json_decode($response, true);
echo "Total: {$data['total']} clientes\n";
foreach ($data['data'] as $customer) {
echo "{$customer['name']} - {$customer['email']}\n";
}
curl_close($ch);
?>
{
"data": [
{
"id": 1,
"name": "João da Silva",
"email": "[email protected]",
"document": "12345678900",
"phone": "+55 11 999999999",
"created_at": "2024-01-15T10:30:00Z"
},
{
"id": 2,
"name": "Maria Santos",
"email": "[email protected]",
"document": "98765432100",
"phone": "+55 11 988888888",
"created_at": "2024-01-16T14:20:00Z"
}
],
"total": 150,
"page": 1,
"lastPage": 8
}
Descrição
Retorna uma lista paginada de clientes cadastrados. Útil para consultar histórico de clientes, gerar relatórios e buscar informações.Headers
string
required
Bearer token JWT obtido no login
Query Parameters
number
default:"1"
Número da página
number
default:"10"
Itens por página (máximo: 100)
string
default:"created_at"
Campo para ordenação
string
default:"DESC"
Direção da ordenação:
ASC ou DESCstring
Filtrar por nome do cliente
string
Filtrar por CPF/CNPJ do cliente
Response
array
number
Total de registros
number
Página atual
number
Última página
curl --request GET \
--url 'https://api.econpay.com.br/customers?page=1&limit=20' \
--header 'Authorization: Bearer SEU_TOKEN_JWT'
curl --request GET \
--url 'https://api.econpay.com.br/customers?name=João' \
--header 'Authorization: Bearer SEU_TOKEN_JWT'
curl --request GET \
--url 'https://api.econpay.com.br/customers?document=12345678900' \
--header 'Authorization: Bearer SEU_TOKEN_JWT'
const response = await fetch(
'https://api.econpay.com.br/customers?page=1&limit=20',
{
headers: { 'Authorization': `Bearer ${token}` }
}
);
const { data, total, page, lastPage } = await response.json();
console.log(`Mostrando ${data.length} de ${total} clientes`);
data.forEach(customer => {
console.log(`${customer.name} - ${customer.email}`);
});
import requests
response = requests.get(
'https://api.econpay.com.br/customers',
headers={'Authorization': f'Bearer {token}'},
params={
'page': 1,
'limit': 20,
'name': 'João'
}
)
data = response.json()
print(f"Total: {data['total']} clientes")
for customer in data['data']:
print(f"{customer['name']} - {customer['document']}")
<?php
$params = http_build_query([
'page' => 1,
'limit' => 20
]);
$ch = curl_init("https://api.econpay.com.br/customers?{$params}");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer ' . $token
]);
$response = curl_exec($ch);
$data = json_decode($response, true);
echo "Total: {$data['total']} clientes\n";
foreach ($data['data'] as $customer) {
echo "{$customer['name']} - {$customer['email']}\n";
}
curl_close($ch);
?>
{
"data": [
{
"id": 1,
"name": "João da Silva",
"email": "[email protected]",
"document": "12345678900",
"phone": "+55 11 999999999",
"created_at": "2024-01-15T10:30:00Z"
},
{
"id": 2,
"name": "Maria Santos",
"email": "[email protected]",
"document": "98765432100",
"phone": "+55 11 988888888",
"created_at": "2024-01-16T14:20:00Z"
}
],
"total": 150,
"page": 1,
"lastPage": 8
}
Exemplos de Uso
Buscar Cliente por Nome
async function findCustomerByName(name) {
const response = await fetch(
`https://api.econpay.com.br/customers?name=${encodeURIComponent(name)}`,
{
headers: { 'Authorization': `Bearer ${token}` }
}
);
const { data } = await response.json();
return data;
}
const customers = await findCustomerByName('João');
console.log(`Encontrados ${customers.length} clientes`);
Buscar Cliente por CPF
async function findCustomerByDocument(document) {
const response = await fetch(
`https://api.econpay.com.br/customers?document=${document}`,
{
headers: { 'Authorization': `Bearer ${token}` }
}
);
const { data } = await response.json();
return data[0]; // Retorna o primeiro (CPF é único)
}
const customer = await findCustomerByDocument('12345678900');
if (customer) {
console.log(`Cliente encontrado: ${customer.name}`);
}
Listar Todos os Clientes (Paginação)
async function getAllCustomers() {
const allCustomers = [];
let page = 1;
let hasMore = true;
while (hasMore) {
const response = await fetch(
`https://api.econpay.com.br/customers?page=${page}&limit=100`,
{
headers: { 'Authorization': `Bearer ${token}` }
}
);
const { data, lastPage } = await response.json();
allCustomers.push(...data);
hasMore = page < lastPage;
page++;
}
return allCustomers;
}
const customers = await getAllCustomers();
console.log(`Total de clientes: ${customers.length}`);
Próximos Passos
Criar Pagamento
Processar pagamento para cliente
Listar Transações
Ver transações do cliente