Listar Transações
curl --request GET \
--url https://garu.com.br/api/transactions \
--header 'Authorization: Bearer <token>'import requests
url = "https://garu.com.br/api/transactions"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://garu.com.br/api/transactions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://garu.com.br/api/transactions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://garu.com.br/api/transactions"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://garu.com.br/api/transactions")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://garu.com.br/api/transactions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": [
{}
],
"count": 123,
"page": 123,
"totalPages": 123
}Transações
Listar Transações
Consulte todas as transações com filtros e paginação
GET
/
api
/
transactions
Listar Transações
curl --request GET \
--url https://garu.com.br/api/transactions \
--header 'Authorization: Bearer <token>'import requests
url = "https://garu.com.br/api/transactions"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://garu.com.br/api/transactions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://garu.com.br/api/transactions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://garu.com.br/api/transactions"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://garu.com.br/api/transactions")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://garu.com.br/api/transactions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": [
{}
],
"count": 123,
"page": 123,
"totalPages": 123
}Visão Geral
Este endpoint retorna uma lista paginada de todas as suas transações. Você pode filtrar por status, produto, cliente e buscar por nome ou email.Exemplo de Requisição
curl -X GET "https://garu.com.br/api/transactions?page=1&limit=20" \
-H "Authorization: Bearer sk_test_sua_chave_api"
const response = await fetch(
'https://garu.com.br/api/transactions?page=1&limit=20',
{
headers: {
'Authorization': `Bearer ${process.env.GARU_API_KEY}`
}
}
);
const { data, count, totalPages } = await response.json();
data.forEach(tx => {
console.log(`${tx.id}: ${tx.status} - R$ ${tx.value}`);
});
import requests
import os
url = "https://garu.com.br/api/transactions"
headers = {
"Authorization": f"Bearer {os.environ['GARU_API_KEY']}"
}
params = {
"page": 1,
"limit": 20
}
response = requests.get(url, headers=headers, params=params)
result = response.json()
for tx in result['data']:
print(f"{tx['id']}: {tx['status']} - R$ {tx['value']}")
Parâmetros de Query
Filtrar por status:
pendingBoleto, pendingPix, captured, payedBoleto, payedPix, denied, reversed, cancel.Resposta de Sucesso
Exemplo de Resposta (200 OK)
{
"data": [
{
"id": 12345,
"galaxPayId": 987654,
"celcoinChargeId": 987654,
"celcoinTransactionId": null,
"status": "captured",
"value": 297.00,
"paymentMethod": "creditcard",
"customer": {
"id": 456,
"name": "João Silva",
"email": "joao@example.com"
},
"product": {
"id": 123,
"name": "Curso de Marketing Digital"
},
"createdAt": "2024-12-24T14:30:00.000Z"
},
{
"id": 12344,
"galaxPayId": 987653,
"celcoinChargeId": 987653,
"celcoinTransactionId": null,
"status": "payedPix",
"value": 47.00,
"paymentMethod": "pix",
"customer": {
"id": 457,
"name": "Maria Santos",
"email": "maria@example.com"
},
"product": {
"id": 124,
"name": "E-book Python"
},
"createdAt": "2024-12-23T10:15:00.000Z"
}
],
"count": 2,
"page": 1,
"totalPages": 5
}
Status de Transação
| Status | Descrição |
|---|---|
pendingBoleto | Boleto gerado, aguardando pagamento |
pendingPix | Código PIX gerado, aguardando pagamento |
authorized | Cartão de crédito autorizado |
captured | Pagamento com cartão capturado |
payedBoleto | Pagamento via boleto confirmado |
payedPix | Pagamento via PIX confirmado |
denied | Pagamento negado |
reversed | Pagamento estornado/reembolsado |
cancel | Transação cancelada |
Paginação
Para percorrer todas as transações:async function listarTodasTransacoes(status) {
const transacoes = [];
let page = 1;
let totalPages = 1;
do {
const url = new URL('https://garu.com.br/api/transactions');
url.searchParams.set('page', page);
url.searchParams.set('limit', 50);
if (status) url.searchParams.set('status', status);
const response = await fetch(url, {
headers: {
'Authorization': `Bearer ${process.env.GARU_API_KEY}`
}
});
const result = await response.json();
transacoes.push(...result.data);
totalPages = result.totalPages;
page++;
} while (page <= totalPages);
return transacoes;
}
// Listar todas as transações pagas
const pagas = await listarTodasTransacoes('captured');
Próximos Passos
Detalhes da Transação
Consulte os detalhes completos de uma transação
Reembolsar
Emita reembolsos totais ou parciais
Was this page helpful?