Skip to main content
GET
https://api.sandbox.wepayout.com.br
/
v2
/
payin
/
payments
List Charge
curl --request GET \
  --url https://api.sandbox.wepayout.com.br/v2/payin/payments \
  --header 'Authorization: Bearer <token>'
{
  "data": [
    {
      "id": 32457,
      "merchant": {
        "id": 1234,
        "name": "Merchant Name"
      },
      "hash": "885fc0a0fb0e678b82a998daafbc081cbb03c1c862f8e57d580b3b7af152cf47",
      "payment_page": "https://pagar.sandbox.wepayout.co/?hash=885fc0a0fb0e678b82a998daafbc081cbb03c1c862f8e57d580b3b7af152cf47",
      "our_number": "20230",
      "invoice": "YOUR-CODE1234",
      "notification_url": "https://client.callback.com/notify-payin",
      "payment_method": "pix",
      "amount": 5000,
      "paid_amount": 5000,
      "refunded_amount": 0,
      "description": "Esse Pix é referente ao pedido 123 na loja abcd",
      "created_at": "2024-06-12T23:04:24.000000Z",
      "updated_at": "2024-06-12T23:04:27.000000Z",
      "buyer": {
        "name": "Buyer Name",
        "email": "[email protected]",
        "document": {
          "type": "CPF",
          "number": "34960826312"
        }
      },
      "status": {
        "id": 4,
        "name": "Pago"
      }
    }
  ],
  "meta": {
    "current_page": 1,
    "from": 1,
    "last_page": 5,
    "per_page": 15,
    "to": 15,
    "total": 73
  },
  "links": {
    "first": "https://api.sandbox.wepayout.com.br/v2/payin/payments?page=1",
    "last": "https://api.sandbox.wepayout.com.br/v2/payin/payments?page=5",
    "prev": null,
    "next": "https://api.sandbox.wepayout.com.br/v2/payin/payments?page=2"
  }
}

List Charge

List all charges with optional filters.

Query Parameters

merchant_id
integer
Merchant id of the account that is creating the payin.Min: 2, Max: 10000
invoice
string
Your identification number.Max length: 255 characters
payment_method
string
Payment method that will be used in payin.Allowed values: pix, boleto
status_id
integer
Filter by status ID.
created_at_start
string
Filter charges created after this date. Format: YYYY-MM-DD
created_at_end
string
Filter charges created before this date. Format: YYYY-MM-DD
updated_at_start
string
Filter charges updated after this date. Format: YYYY-MM-DD
updated_at_end
string
Filter charges updated before this date. Format: YYYY-MM-DD
page
integer
Page number for pagination.Default: 1
per_page
integer
Number of items per page.Default: 15, Max: 100
sort_by
string
Field to sort by.Allowed values: id, created_at, updated_at, amountDefault: id
sort_order
string
Sort order.Allowed values: asc, descDefault: desc

Response

Returns an array of charge objects with pagination metadata.
data
array
Array of charge objects.
meta
object
Pagination metadata.
Pagination links.

Request Example

curl --request GET \
  --url '"https://api.sandbox.wepayout.com.br/v2/payin/payments?page=1&per_page=15"' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer 123'
{
  "data": [
    {
      "id": 32457,
      "merchant": {
        "id": 1234,
        "name": "Merchant Name"
      },
      "hash": "885fc0a0fb0e678b82a998daafbc081cbb03c1c862f8e57d580b3b7af152cf47",
      "payment_page": "https://pagar.sandbox.wepayout.co/?hash=885fc0a0fb0e678b82a998daafbc081cbb03c1c862f8e57d580b3b7af152cf47",
      "our_number": "20230",
      "invoice": "YOUR-CODE1234",
      "notification_url": "https://client.callback.com/notify-payin",
      "payment_method": "pix",
      "amount": 5000,
      "paid_amount": 5000,
      "refunded_amount": 0,
      "description": "Esse Pix é referente ao pedido 123 na loja abcd",
      "created_at": "2024-06-12T23:04:24.000000Z",
      "updated_at": "2024-06-12T23:04:27.000000Z",
      "buyer": {
        "name": "Buyer Name",
        "email": "[email protected]",
        "document": {
          "type": "CPF",
          "number": "34960826312"
        }
      },
      "status": {
        "id": 4,
        "name": "Pago"
      }
    }
  ],
  "meta": {
    "current_page": 1,
    "from": 1,
    "last_page": 5,
    "per_page": 15,
    "to": 15,
    "total": 73
  },
  "links": {
    "first": "https://api.sandbox.wepayout.com.br/v2/payin/payments?page=1",
    "last": "https://api.sandbox.wepayout.com.br/v2/payin/payments?page=5",
    "prev": null,
    "next": "https://api.sandbox.wepayout.com.br/v2/payin/payments?page=2"
  }
}

Use Cases

Retrieve all charges with pagination:
async function getAllCharges(page = 1, perPage = 15) {
  const response = await fetch(
    `https://api.sandbox.wepayout.com.br/v2/payin/payments?page=${page}&per_page=${perPage}`,
    {
      headers: {
        'Authorization': 'Bearer YOUR_TOKEN',
        'Accept': 'application/json'
      }
    }
  );
  
  return await response.json();
}
Get charges by specific status:
async function getChargesByStatus(statusId) {
  const response = await fetch(
    `https://api.sandbox.wepayout.com.br/v2/payin/payments?status_id=${statusId}`,
    {
      headers: {
        'Authorization': 'Bearer YOUR_TOKEN',
        'Accept': 'application/json'
      }
    }
  );
  
  return await response.json();
}

// Get paid charges (status_id = 4)
const paidCharges = await getChargesByStatus(4);
Find a specific charge by invoice number:
async function findChargeByInvoice(invoice) {
  const response = await fetch(
    `https://api.sandbox.wepayout.com.br/v2/payin/payments?invoice=${invoice}`,
    {
      headers: {
        'Authorization': 'Bearer YOUR_TOKEN',
        'Accept': 'application/json'
      }
    }
  );
  
  const data = await response.json();
  return data.data[0]; // Return first match
}
Generate a report for a specific date range:
async function getChargesReport(startDate, endDate) {
  const params = new URLSearchParams({
    created_at_start: startDate,
    created_at_end: endDate,
    per_page: 100,
    sort_by: 'created_at',
    sort_order: 'asc'
  });
  
  const response = await fetch(
    `https://api.sandbox.wepayout.com.br/v2/payin/payments?${params}`,
    {
      headers: {
        'Authorization': 'Bearer YOUR_TOKEN',
        'Accept': 'application/json'
      }
    }
  );
  
  return await response.json();
}

// Get charges from January 2024
const report = await getChargesReport('2024-01-01', '2024-01-31');
Handle pagination to retrieve all charges:
async function getAllChargesWithPagination() {
  let allCharges = [];
  let currentPage = 1;
  let hasMorePages = true;
  
  while (hasMorePages) {
    const response = await fetch(
      `https://api.sandbox.wepayout.com.br/v2/payin/payments?page=${currentPage}&per_page=100`,
      {
        headers: {
          'Authorization': 'Bearer YOUR_TOKEN',
          'Accept': 'application/json'
        }
      }
    );
    
    const data = await response.json();
    allCharges = allCharges.concat(data.data);
    
    hasMorePages = data.meta.current_page < data.meta.last_page;
    currentPage++;
  }
  
  return allCharges;
}

Status IDs

Common status IDs for filtering:
IDStatus NameDescription
1CriadoCharge created
2ProcessandoProcessing
3Aguardando PagamentoAwaiting payment
4PagoPaid
5CanceladoCancelled
6ExpiradoExpired
7RejeitadoRejected
8EstornadoRefunded

Best Practices

Pagination: Always use pagination when listing charges to avoid performance issues. The default page size is 15, with a maximum of 100 items per page.
Date Filters: When using date range filters, ensure the range is not too large to avoid timeouts. For large date ranges, consider breaking them into smaller chunks.
Caching: Consider caching the results for frequently accessed pages to reduce API calls and improve performance.