Skip to main content
GET
https://api.sandbox.wepayout.com.br
/
v2
/
account
/
{merchantId}
/
statement
Get Statement
curl --request GET \
  --url https://api.sandbox.wepayout.com.br/v2/account/{merchantId}/statement \
  --header 'Authorization: Bearer <token>'
[
  {
    "id": 1,
    "entity_id": "ent_123",
    "category": {
      "id": 1,
      "name": "Transfer In"
    },
    "amount": 5000.00,
    "available_balance": 15000.00,
    "reserve_balance": 0,
    "invoice": "INV-001",
    "description": "Payment received",
    "merchant_id": "merchant_123",
    "created_at": "2024-01-15T10:30:00Z"
  }
]

Get Statement

Retrieve account statement with transaction history.

Path Parameters

merchantId
string
required
Merchant ID

Query Parameters

category_id
string
Transaction category idAllowed values: Transfer In (P-1), Payout Received (P-2), Pix Taxes (P-3), Taxes Tax (P-5), Tax Taxes (S-1), Transference (S-11), Tax (S-13), Taxes Taxes (S-14), Transfer Taxes (S-15), Others Taxes (S-16)
created_date
string
Creation date YYYY-MM-DDExample: 2024-01-15
id
string
Transaction id or statement value that exist if provided. Value is located into the “created_id” or “movement_id”Return values: q, d, dd
import_balance
string
Inform if you want to see the balance of the statementValues: YYYY-MM-DDExample: 2024-01-15
movement_date
string
Movement dateValues: YYYY-MM-DDExample: 2024-01-15
page
integer
Page number
per_page
integer
Quantity of items per page

Response Headers

x-next-page
string
Next page number
x-page
string
Current page number
x-per-page
string
Total items per page
x-prev-page
string
Previous page number
x-total-count
string
Total count
x-total-pages
string
Total pages

Response Body

array
array
Array of statement entries

Request Example

curl --request GET \
  --url 'https://api.sandbox.wepayout.com.br/v2/account/{merchantId}/statement' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer {token}'
[
  {
    "id": 1,
    "entity_id": "ent_123",
    "category": {
      "id": 1,
      "name": "Transfer In"
    },
    "amount": 5000.00,
    "available_balance": 15000.00,
    "reserve_balance": 0,
    "invoice": "INV-001",
    "description": "Payment received",
    "merchant_id": "merchant_123",
    "created_at": "2024-01-15T10:30:00Z"
  }
]

Transaction Categories

The statement includes various transaction categories:
CategoryCodeDescription
Transfer InP-1Incoming transfers
Payout ReceivedP-2Received payouts
Pix TaxesP-3Pix transaction fees
Taxes TaxP-5Tax charges
Tax TaxesS-1Tax-related charges
TransferenceS-11Transfer transactions
TaxS-13General taxes
Taxes TaxesS-14Multiple tax charges
Transfer TaxesS-15Transfer-related taxes
Others TaxesS-16Other tax categories

Pagination

The API uses header-based pagination:
// Get first page
const page1 = await getStatement(merchantId, { page: 1, per_page: 50 });

// Check if there are more pages
const nextPage = response.headers.get('x-next-page');
if (nextPage) {
  const page2 = await getStatement(merchantId, { page: nextPage, per_page: 50 });
}

Use Cases

Generate a complete monthly statement for accounting:
async function getMonthlyStatement(merchantId, year, month) {
  const startDate = `${year}-${String(month).padStart(2, '0')}-01`;
  const endDate = new Date(year, month, 0);
  const endDateStr = endDate.toISOString().split('T')[0];
  
  let allStatements = [];
  let page = 1;
  let hasMore = true;
  
  while (hasMore) {
    const response = await fetch(
      `https://api.wepayments.com/v2/account/${merchantId}/statement?created_date=${startDate}&page=${page}&per_page=100`,
      {
        headers: {
          'Authorization': 'Bearer YOUR_TOKEN',
          'Accept': 'application/json'
        }
      }
    );
    
    const data = await response.json();
    allStatements = allStatements.concat(data);
    
    const nextPage = response.headers.get('x-next-page');
    hasMore = nextPage !== null;
    page = nextPage;
  }
  
  return allStatements;
}
Retrieve transactions for a specific category:
async function getTransactionsByCategory(merchantId, categoryId) {
  const response = await fetch(
    `https://api.wepayments.com/v2/account/${merchantId}/statement?category_id=${categoryId}`,
    {
      headers: {
        'Authorization': 'Bearer YOUR_TOKEN',
        'Accept': 'application/json'
      }
    }
  );
  
  return await response.json();
}

// Get all Pix tax transactions
const pixTaxes = await getTransactionsByCategory(merchantId, 'Pix Taxes (P-3)');
Calculate total fees paid in a period:
async function calculateTotalFees(merchantId, startDate, endDate) {
  const statements = await getStatementRange(merchantId, startDate, endDate);
  
  const feeCategories = [
    'Pix Taxes (P-3)',
    'Taxes Tax (P-5)',
    'Tax Taxes (S-1)',
    'Tax (S-13)',
    'Transfer Taxes (S-15)',
    'Others Taxes (S-16)'
  ];
  
  const totalFees = statements
    .filter(s => feeCategories.includes(s.category.name))
    .reduce((sum, s) => sum + Math.abs(s.amount), 0);
  
  return totalFees;
}
Export statement data to CSV format:
async function exportStatementToCSV(merchantId, startDate, endDate) {
  const statements = await getStatementRange(merchantId, startDate, endDate);
  
  const headers = ['Date', 'Category', 'Description', 'Amount', 'Balance'];
  const rows = statements.map(s => [
    s.created_at,
    s.category.name,
    s.description,
    s.amount,
    s.available_balance
  ]);
  
  const csv = [headers, ...rows]
    .map(row => row.join(','))
    .join('\n');
  
  return csv;
}
Monitor balance changes over time:
async function trackBalanceChanges(merchantId, date) {
  const statements = await getStatement(merchantId, {
    created_date: date,
    import_balance: date
  });
  
  const balanceHistory = statements.map(s => ({
    timestamp: s.created_at,
    amount: s.amount,
    balance: s.available_balance,
    category: s.category.name
  }));
  
  return balanceHistory;
}

Best Practices

Use Pagination: Always implement pagination when retrieving statements to avoid timeouts and memory issues with large datasets.
Date Filters: Use date filters (created_date, movement_date) to limit the result set and improve performance.
Balance Import: Use the import_balance parameter to include balance information in the statement response.

Integration Example

class StatementService {
  constructor(apiKey, merchantId) {
    this.apiKey = apiKey;
    this.merchantId = merchantId;
    this.baseUrl = 'https://api.wepayments.com/v2';
  }
  
  async getStatement(params = {}) {
    const queryParams = new URLSearchParams(params);
    const url = `${this.baseUrl}/account/${this.merchantId}/statement?${queryParams}`;
    
    const response = await fetch(url, {
      headers: {
        'Authorization': `Bearer ${this.apiKey}`,
        'Accept': 'application/json'
      }
    });
    
    const data = await response.json();
    const headers = {
      nextPage: response.headers.get('x-next-page'),
      page: response.headers.get('x-page'),
      perPage: response.headers.get('x-per-page'),
      prevPage: response.headers.get('x-prev-page'),
      totalCount: response.headers.get('x-total-count'),
      totalPages: response.headers.get('x-total-pages')
    };
    
    return { data, headers };
  }
  
  async getAllStatements(params = {}) {
    let allStatements = [];
    let page = 1;
    let hasMore = true;
    
    while (hasMore) {
      const { data, headers } = await this.getStatement({ ...params, page });
      allStatements = allStatements.concat(data);
      
      hasMore = headers.nextPage !== null;
      page = parseInt(headers.nextPage);
    }
    
    return allStatements;
  }
  
  async getStatementByDateRange(startDate, endDate) {
    return await this.getAllStatements({
      created_date: startDate,
      per_page: 100
    });
  }
  
  async getStatementByCategory(categoryId) {
    return await this.getAllStatements({
      category_id: categoryId,
      per_page: 100
    });
  }
  
  async calculateNetAmount(startDate, endDate) {
    const statements = await this.getStatementByDateRange(startDate, endDate);
    
    const netAmount = statements.reduce((sum, s) => sum + s.amount, 0);
    const credits = statements
      .filter(s => s.amount > 0)
      .reduce((sum, s) => sum + s.amount, 0);
    const debits = statements
      .filter(s => s.amount < 0)
      .reduce((sum, s) => sum + Math.abs(s.amount), 0);
    
    return { netAmount, credits, debits };
  }
}

// Usage
const statementService = new StatementService('YOUR_API_KEY', 'MERCHANT_ID');

// Get first page of statements
const { data, headers } = await statementService.getStatement({ page: 1, per_page: 50 });
console.log(`Total statements: ${headers.totalCount}`);

// Get all statements for a date range
const allStatements = await statementService.getStatementByDateRange('2024-01-01', '2024-01-31');
console.log(`Retrieved ${allStatements.length} statements`);

// Calculate net amount
const { netAmount, credits, debits } = await statementService.calculateNetAmount('2024-01-01', '2024-01-31');
console.log(`Net: ${netAmount}, Credits: ${credits}, Debits: ${debits}`);