Skip to main content

Overview

GatePay provides multiple reconciliation tools to ensure account accuracy:
  • Balance Query: Real-time available balance by currency
  • Order Fee Query: Verify fees and settlement amounts at the order level
  • Funds Ledger Query: Track all fund movements by transaction
For request headers, signature rules, and callback verification, refer to Authentication & Security.

Balance Query

The balance query API retrieves the available balance of a merchant payment account by currency. For settlement, payout, and risk decisions, real-time query results must be used.

Common Use Cases

  • Pre-settlement validation: Confirm available balance before initiating settlement
  • Period-end snapshots: Capture balance at close of business for accounting
  • Operational monitoring: Real-time balance alerts and thresholds
  • Multi-currency management: Track balances across different currencies

API Reference

Endpoint: GET /v1/pay/balance/query Institutional Endpoint: POST /payment/open/institution/v1/balance

Request Parameters

If no currencies are specified, the API returns balances for all currencies in the account.

Response Fields

Example Request

Example Response

Integration Steps

  1. Call the balance query API using GET /v1/pay/balance/query with desired currencies
  2. Store balances by currency in your merchant’s local accounting system
  3. Compare with local records to identify discrepancies
  4. Alert on thresholds if balance falls below operational minimums

Order Fee Query

The order fee query API provides detailed fee breakdown and settlement amounts at the individual order level. Use this for financial reconciliation and exception investigation.

Common Use Cases

  • Financial reconciliation: Verify fees match merchant expectations
  • Multiple or partial payments: Reconcile complex order scenarios
  • Exception investigation: Identify fee anomalies or discrepancies
  • Settlement confirmation: Confirm amounts before initiating payout

API Reference

Endpoint: GET /api/open/v1/pay/order/fee/query

Request Parameters

Provide either orderId or merchant_order_no (at least one required).

Response Fields

Example Request

Example Response

Integration Steps

  1. Call the order fee query API using GET /api/open/v1/pay/order/fee/query with order identifier
  2. Store the query result alongside your local order master data
  3. Compare settlement amounts with expected values
  4. Flag discrepancies for manual review if fee structure differs

Funds Ledger Query

The funds ledger query provides a complete transaction history of all fund movements in and out of the merchant account. This is essential for audit trails and comprehensive reconciliation.

Common Use Cases

  • End-of-day reconciliation: Aggregate all fund movements for the day
  • Audit tracing: Track fund origins and destinations for compliance
  • Exception investigation: Identify timing issues or missing transactions
  • Financial reporting: Generate detailed movement reports by type and currency

API Reference

Endpoint: GET /v1/pay/bill/orderlist Institutional Endpoint: GET /payment/open/institution/v1/pay/bill/orderlist

Request Parameters

Response Fields

Transaction Type Enumeration

Example Request

Example Response

Integration Steps

  1. Pull funds ledger records by time range with pagination using GET /v1/pay/bill/orderlist
  2. Persist ledger records in your database using ledger_id as the primary deduplication key
  3. Associate ledger records with business orders using business_id and metadata
  4. Generate reconciliation summaries aggregated by:
    • Currency
    • Transaction type
    • Date or time bucket
    • Related business entity (order, refund, transfer, etc.)
  5. Compare with local records to identify discrepancies
  6. Flag unmatched records for investigation

Follow this step-by-step process for comprehensive daily reconciliation:

Step 1: Capture Account Balance Snapshot

Store the balance snapshot for each currency at end of business day (e.g., 11:59 PM UTC). Record:
  • Available balance
  • Hold amount
  • Total balance
  • Snapshot timestamp

Step 2: Pull Funds Ledger Records

Retrieve all transactions for the reconciliation period with pagination. Store in local database keyed by ledger_id.

Step 3: Pull Order Fees and Settlement Amounts

For each order settled during the day:
Store fee breakdown and settlement details.

Step 4: Match and Reconcile Records

Create a reconciliation table with the following structure: Matching logic:
  • Match PAYMENT ledger entries to your order system using business_id
  • Match REFUND entries to your refund system
  • Match TRANSFER_OUT/IN entries to your transfer records
  • Match PAYOUT entries to your settlement records

Step 5: Generate Discrepancy Report

Identify records that do not match:

Step 6: Perform Manual Review

For each discrepancy:
  1. Review the ledger entry description and metadata
  2. Correlate with business records (orders, refunds, transfers)
  3. Investigate timing (same-day vs. next-day settlement)
  4. Document resolution (matched, explained, or escalated)

Step 7: Output Reconciliation Result

Generate a formal reconciliation statement:

Error Handling and Troubleshooting

Common Issues

For comprehensive error codes, see Error Codes & Best Practices.

Best Practices

Data Persistence

  • Primary Key: Use ledger_id for ledger entries to ensure idempotency
  • Unique Constraints: Enforce unique constraints on (ledger_id) to prevent duplicates
  • Indexing: Index by (created_at, currency, type) for fast reconciliation queries

Query Optimization

  • Time ranges: Query in 24-hour buckets for faster response times
  • Pagination: Use limit=100 and iterate through pages to avoid timeout
  • Filters: Use currency and type filters to reduce result sets

Alerting and Monitoring

  • Threshold alerts: Alert when available balance falls below operational minimum
  • Discrepancy alerts: Alert immediately when reconciliation identifies unmatched records
  • Timing alerts: Alert if ledger entries are delayed by more than 2 hours
  • Callback failure alerts: Alert if expected callbacks are not received within SLA

Documentation and Audit

  • Reconciliation logs: Store reconciliation results with timestamp and user ID
  • Discrepancy tracking: Maintain audit trail of identified and resolved discrepancies
  • Rate cards: Document fee structure and any promotional adjustments
  • Settlement terms: Document when and how funds are settled to merchant accounts