# Card payments

Card and online payments: confirmed, in transit, settled.

## POST /v1/gateway-settlements

**The money landed in the bank, net of the gateway's cut**

Dr bank what landed, Dr merchant fees the difference, Cr clearing the gross that was confirmed. Batched, because gateways settle in batches: name the gateway refs in the payout.

Parameters:

- `Idempotency-Key` (header, required): Required on this call. Retrying with the same key returns the original response instead of doing it twice. Reusing a key with a different body is a 422.

Body:

- `gateway_code` string, required
- `gateway_refs` array of string, required
- `amount_received` number, required: Net, as it appears on the bank statement. The difference from the gross becomes the fee.
- `bank_account_id` string (uuid)
- `settled_on` string (date)

```json
{
  "gateway_code": "string",
  "gateway_refs": [
    "string"
  ],
  "amount_received": 100
}
```

Answers:

- `201` journal_id, gross, fee, payments_settled
- `422` Refs not in transit, or a settlement larger than the gross confirmed

## GET /v1/gateway-payments

**In transit — the list that needs handling**

Confirmed by a gateway, not yet in the bank. overdue is anything past that gateway's own settlement window (7 days by default). The total ties to the clearing account on the trial balance.

Parameters:

- `overdueOnly` (query)

Answers:

- `200` total_in_transit, overdue_count, and the payments with days_in_transit
