Listar facturas
Obtiene un listado paginado de facturas de tu cuenta.
GET
/
invoices
curl https://api.onepay.la/v1/invoices?page=1&filter[status]=CREATED&sort=-created_at \
-H "Authorization: Bearer sk_test_KjbE0Vobf5Lg1yNZ4HoKawDItDs3Rod9VXNBWrEYmGn06tkesPIi"
const response = await fetch('https://api.onepay.la/v1/invoices?page=1&filter[status]=CREATED&sort=-created_at', {
method: 'GET',
headers: {
'Authorization': 'Bearer sk_test_KjbE0Vobf5Lg1yNZ4HoKawDItDs3Rod9VXNBWrEYmGn06tkesPIi'
}
});
const data = await response.json();
console.log(data.data); // Array de facturas
console.log(data.total); // Total de facturas
import requests
url = "https://api.onepay.la/v1/invoices"
headers = {
"Authorization": "Bearer sk_test_KjbE0Vobf5Lg1yNZ4HoKawDItDs3Rod9VXNBWrEYmGn06tkesPIi"
}
params = {
"page": 1,
"filter[status]": "CREATED",
"sort": "-created_at"
}
response = requests.get(url, headers=headers, params=params)
data = response.json()
print(data["data"]) # Array de facturas
print(data["total"]) # Total de facturas
<?php
$ch = curl_init();
$url = "https://api.onepay.la/v1/invoices?" . http_build_query([
"page" => 1,
"filter" => ["status" => "CREATED"],
"sort" => "-created_at"
]);
curl_setopt_array($ch, [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer sk_test_KjbE0Vobf5Lg1yNZ4HoKawDItDs3Rod9VXNBWrEYmGn06tkesPIi"
]
]);
$response = curl_exec($ch);
$data = json_decode($response, true);
print_r($data["data"]); // Array de facturas
echo $data["total"]; // Total de facturas
curl_close($ch);
?>
{
"data": [
{
"id": "2f2b1e5a-1a2b-4c33-8a18-5e9f3b9f4b1a",
"name": "Internet plan - Octubre",
"provider": "biller",
"provider_id": "987654",
"reference": "INV-12345678",
"status": "CREATED",
"remarks": null,
"metadata": {
"key": "value"
}
}
],
"current_page": 1,
"from": 1,
"last_page": 2,
"per_page": 20,
"to": 20,
"total": 21
}
Query params
Ordena por fecha de creación. Valores permitidos: created_at o -created_at. Por defecto -created_at.
curl https://api.onepay.la/v1/invoices?page=1&filter[status]=CREATED&sort=-created_at \
-H "Authorization: Bearer sk_test_KjbE0Vobf5Lg1yNZ4HoKawDItDs3Rod9VXNBWrEYmGn06tkesPIi"
const response = await fetch('https://api.onepay.la/v1/invoices?page=1&filter[status]=CREATED&sort=-created_at', {
method: 'GET',
headers: {
'Authorization': 'Bearer sk_test_KjbE0Vobf5Lg1yNZ4HoKawDItDs3Rod9VXNBWrEYmGn06tkesPIi'
}
});
const data = await response.json();
console.log(data.data); // Array de facturas
console.log(data.total); // Total de facturas
import requests
url = "https://api.onepay.la/v1/invoices"
headers = {
"Authorization": "Bearer sk_test_KjbE0Vobf5Lg1yNZ4HoKawDItDs3Rod9VXNBWrEYmGn06tkesPIi"
}
params = {
"page": 1,
"filter[status]": "CREATED",
"sort": "-created_at"
}
response = requests.get(url, headers=headers, params=params)
data = response.json()
print(data["data"]) # Array de facturas
print(data["total"]) # Total de facturas
<?php
$ch = curl_init();
$url = "https://api.onepay.la/v1/invoices?" . http_build_query([
"page" => 1,
"filter" => ["status" => "CREATED"],
"sort" => "-created_at"
]);
curl_setopt_array($ch, [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer sk_test_KjbE0Vobf5Lg1yNZ4HoKawDItDs3Rod9VXNBWrEYmGn06tkesPIi"
]
]);
$response = curl_exec($ch);
$data = json_decode($response, true);
print_r($data["data"]); // Array de facturas
echo $data["total"]; // Total de facturas
curl_close($ch);
?>
Response
{
"data": [
{
"id": "2f2b1e5a-1a2b-4c33-8a18-5e9f3b9f4b1a",
"name": "Internet plan - Octubre",
"provider": "biller",
"provider_id": "987654",
"reference": "INV-12345678",
"status": "CREATED",
"remarks": null,
"metadata": {
"key": "value"
}
}
],
"current_page": 1,
"from": 1,
"last_page": 2,
"per_page": 20,
"to": 20,
"total": 21
}
- La respuesta usa un formateador de colección personalizado que expone los datos de paginación en la raíz de la respuesta (current_page, from, last_page, per_page, to, total), además de la clave data.
- El listado no incluye el objeto payment anidado por rendimiento; se expone en el detalle y en la creación.
Was this page helpful?
⌘I
curl https://api.onepay.la/v1/invoices?page=1&filter[status]=CREATED&sort=-created_at \
-H "Authorization: Bearer sk_test_KjbE0Vobf5Lg1yNZ4HoKawDItDs3Rod9VXNBWrEYmGn06tkesPIi"
const response = await fetch('https://api.onepay.la/v1/invoices?page=1&filter[status]=CREATED&sort=-created_at', {
method: 'GET',
headers: {
'Authorization': 'Bearer sk_test_KjbE0Vobf5Lg1yNZ4HoKawDItDs3Rod9VXNBWrEYmGn06tkesPIi'
}
});
const data = await response.json();
console.log(data.data); // Array de facturas
console.log(data.total); // Total de facturas
import requests
url = "https://api.onepay.la/v1/invoices"
headers = {
"Authorization": "Bearer sk_test_KjbE0Vobf5Lg1yNZ4HoKawDItDs3Rod9VXNBWrEYmGn06tkesPIi"
}
params = {
"page": 1,
"filter[status]": "CREATED",
"sort": "-created_at"
}
response = requests.get(url, headers=headers, params=params)
data = response.json()
print(data["data"]) # Array de facturas
print(data["total"]) # Total de facturas
<?php
$ch = curl_init();
$url = "https://api.onepay.la/v1/invoices?" . http_build_query([
"page" => 1,
"filter" => ["status" => "CREATED"],
"sort" => "-created_at"
]);
curl_setopt_array($ch, [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer sk_test_KjbE0Vobf5Lg1yNZ4HoKawDItDs3Rod9VXNBWrEYmGn06tkesPIi"
]
]);
$response = curl_exec($ch);
$data = json_decode($response, true);
print_r($data["data"]); // Array de facturas
echo $data["total"]; // Total de facturas
curl_close($ch);
?>
{
"data": [
{
"id": "2f2b1e5a-1a2b-4c33-8a18-5e9f3b9f4b1a",
"name": "Internet plan - Octubre",
"provider": "biller",
"provider_id": "987654",
"reference": "INV-12345678",
"status": "CREATED",
"remarks": null,
"metadata": {
"key": "value"
}
}
],
"current_page": 1,
"from": 1,
"last_page": 2,
"per_page": 20,
"to": 20,
"total": 21
}