Skip to Content
StagePayDocs v2

Settlement Query API

How to query settlement batches and lines as JSON or CSV (Accept text/csv) with GET /api/v1/settlements, /{batchNo}, and /{batchNo}/lines, and the response fields.

The merchant server can query its own app's settlement batches via the REST API.

  • Authentication: API key, requires the settlement:read scope (not included in read:all)
  • Only batches for the app linked to the key are returned. Batch numbers of other apps return 404
  • DRAFT and CANCELLED batches, which are internal working states, are not exposed (404)
  • Responses are not cached (Cache-Control: no-store)

Batch list

GET /api/v1/settlements?status=APPROVED&from=2026-01-01T00:00:00%2B09:00&to=2026-04-01T00:00:00%2B09:00&limit=50&skip=0
QueryDescription
statusOne of VERIFIED, APPROVED, PAID, CARRIED_FORWARD
from / toRange based on the period start (periodStart): from ≤ periodStart < to (ISO 8601)
limit / skipDefault 50 / 0; limit up to 500

Results are sorted by period start, descending. total is the total number of exposed batches that match the filter (DRAFT and CANCELLED are excluded at query time, so they are not counted either). If skip + data.length < total, there is a next page.

200 OK
{
  "data": [
    {
      "batchNo": "STL-20260101-6650f0c2a1b2c3d4e5f60718-KRW-0007",
      "appId": "6650f0c2a1b2c3d4e5f60718",
      "currency": "KRW",
      "periodStart": "2025-12-31T15:00:00.000Z",
      "periodEnd": "2026-01-31T15:00:00.000Z",
      "payoutDueDate": "2026-02-15T15:00:00.000Z",
      "status": "APPROVED",
      "carryReason": null,
      "totals": {
        "count": 4,
        "saleCount": 3,
        "adjustmentCount": 1,
        "grossMinor": "20300",
        "refundMinor": "9300",
        "feeMinor": "385",
        "vatMinor": "39",
        "adjustmentMinor": "-3846",
        "carriedInMinor": "0",
        "netMinor": "10576"
      },
      "checksum": "5d0c4f6e…",
      "verified": true,
      "paidAt": null,
      "payoutRef": null
    }
  ],
  "total": 1
}

Batch fields

FieldDescription
batchNoBatch number (format)
periodStart / periodEndSettlement period [start, end). Values are in UTC but aligned to midnight in the policy timezone (example above: January in KST)
payoutDueDatePayout due date (periodEnd + holdDays)
statusBatch status
carryReasonCarry-forward reason NEGATIVE_NET / BELOW_MIN_PAYOUT, or null
totals.*MinorTotals (minor unit, strings). For definitions, see Batch totals
totals.netMinorPayout (or carry-forward) amount
checksumBatch checksum
verifiedWhether the last verification result matched
paidAt / payoutRefPayout time / payout reference number (when PAID)

Batch details

GET /api/v1/settlements/STL-20260101-6650f0c2a1b2c3d4e5f60718-KRW-0007

The response is { "data": <batch object> }.

Settlement lines

GET /api/v1/settlements/{batchNo}/lines?limit=200&skip=0
Accept: application/json
QueryDescription
limit / skipDefault 200 / 0; limit up to 5000. Sort: kind → tid
200 OK
{
  "data": [
    {
      "kind": "REFUND_ADJUSTMENT",
      "tid": "STRIPE-20251220110000654321-d4e5f6-1a2b3c4d",
      "refundId": "rf_01JH2X8Q4M3N",
      "grossMinor": "0",
      "refundMinor": "4000",
      "percentFeeMinor": "-140",
      "fixedFeeMinor": "0",
      "feeMinor": "-140",
      "vatMinor": "-14",
      "netMinor": "-3846",
      "formula": "-refund 4000 - fee(-140+0) - vat -14 = -3846 [orig STL-20251201-6650f0c2a1b2c3d4e5f60718-KRW-0006]",
      "refOriginalBatchNo": "STL-20251201-6650f0c2a1b2c3d4e5f60718-KRW-0006"
    },
    {
      "kind": "SALE",
      "tid": "KCP-20260115120000123456-a1b2c3-9f8e7d6c",
      "paidAt": "2026-01-15T03:00:00.000Z",
      "grossMinor": "5000",
      "refundMinor": "2000",
      "percentFeeMinor": "105",
      "fixedFeeMinor": "0",
      "feeMinor": "105",
      "vatMinor": "11",
      "netMinor": "2884",
      "formula": "gross 5000 - refund 2000 - fee(105+0) - vat 11 = 2884 [fee 350bps, vat 1000bps]"
    }
  ],
  "total": 4
}
FieldDescription
kindSALE (sale) or REFUND_ADJUSTMENT (refund adjustment for a transaction from a previous batch)
tidTransaction ID
refundIdRefund ID of an adjustment line (absent for sale lines)
paidAtPayment confirmation time of the original transaction
grossMinor … netMinorEach item from the calculation (strings; can be negative for adjustment lines)
formulaHuman-readable basis for the calculation
refOriginalBatchNoAdjustment lines: the batch in which the original transaction was settled

CSV download

Send Accept: text/csv to the same path to receive all lines of the batch as a CSV file (limit/skip are ignored).

curl -H "Authorization: Bearer $STAGEPAY_KEY_ID:$STAGEPAY_KEY_SECRET" \
     -H "Accept: text/csv" \
     -o settlement.csv \
     https://api.stagepay.io/api/v1/settlements/STL-20260101-6650f0c2a1b2c3d4e5f60718-KRW-0007/lines
  • File name: Content-Disposition: attachment; filename="{batchNo}.csv"
  • Encoding: UTF-8 BOM + CRLF line endings (opens directly in Excel)
  • Structure: ① 2 batch header rows → blank row → ② line header + lines → blank row → ③ TOTAL row
batchNo,appId,currency,periodStart,periodEnd,status,checksum
STL-20260101-6650f0c2a1b2c3d4e5f60718-KRW-0007,6650f0c2a1b2c3d4e5f60718,KRW,2025-12-31T15:00:00.000Z,2026-01-31T15:00:00.000Z,APPROVED,5d0c4f6e…

kind,tid,refundId,paidAt,grossMinor,refundMinor,percentFeeMinor,fixedFeeMinor,feeMinor,vatMinor,netMinor,formula
REFUND_ADJUSTMENT,STRIPE-20251220110000654321-d4e5f6-1a2b3c4d,rf_01JH2X8Q4M3N,,0,4000,-140,0,-140,-14,-3846,'-refund 4000 - fee(-140+0) - vat -14 = -3846 [orig STL-20251201-…-0006]
SALE,KCP-20260115120000123456-a1b2c3-9f8e7d6c,,2026-01-15T03:00:00.000Z,5000,2000,105,0,105,11,2884,gross 5000 - refund 2000 - fee(105+0) - vat 11 = 2884 [fee 350bps, vat 1000bps]

TOTAL,,,,20300,9300,,,385,39,10576,carriedIn 0

To prevent formula injection, text values (other than integers) that start with =, +, -, or @ are prefixed with '. This is why the adjustment line's formula in the example above starts with '-refund …. As in JSON, lines are ordered by kind (REFUND_ADJUSTMENT → SALE) → tid.

Reconciliation

  1. Each month, query batches with status=APPROVED or PAID and compare netMinor with the amount actually received.
  2. Match the lines' tid against your merchant order DB to check for omissions and duplicates.
  3. Link REFUND_ADJUSTMENT lines to their original batches via refOriginalBatchNo for refund accounting.
  4. Store the received checksum and confirm it is unchanged when you query again.

On this page