APG PayAPG Paydocs

Loans

Cancel a loan statement

Withdraw a loan's latest statement and have its movements billed on the next one instead.

A statement bills the movements recorded on a loan since the one before it. Cancelling the latest statement withdraws that bill without writing anything to the loan's ledger: the movements stay exactly where they are, and the next statement you cut bills them again, together with whatever has been recorded since.

So a cancel never moves a balance. What it changes is which statement the movements belong to.

Check it is the one you mean. Only a loan's most recent statement can be cancelled, and only while it is Draft, Outstanding, Due or Overdue.

Request
curl -X GET "https://api.tst.au.apgpay.dev/bezel/loan-statements/<useLoanStatementIdFromSeed>" \
  -H "Authorization: Bearer $API_SECRET_KEY"

The statement comes back with status: Cancelled. The arm carries no fields.

Request
curl -X PATCH "https://api.tst.au.apgpay.dev/bezel/loan-statements/<useLoanStatementIdFromSeed>" \
  -H "Authorization: Bearer $API_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "type": "LstmtUpdateCancelLatest"
}'
A cancel is refused with a 400 when the statement: - is not the loan's latest, because a later statement has already billed past it; - is Defaulted or already Cancelled; - is Paid, unless it is a credit statement (more refunds than charges) with nothing paid towards it and none of its credit yet applied to another statement; - has a manual payment recorded against it, because the next statement would bill those movements again without the payment; - is a late-fee statement, or has a live late-fee statement of its own. Cancel the late fee first with LstmtUpdateCancelLateFee.

The loan's balances read the same before and after, because nothing was posted to its ledger.

Request
curl -X GET "https://api.tst.au.apgpay.dev/bezel/loans/<useLoanIdFromSeed>" \
  -H "Authorization: Bearer $API_SECRET_KEY"

It bills the cancelled statement's movements as well as anything recorded since, and its period starts where the cancelled one's did. The balances move only by the new movements.

Request
curl -X POST "https://api.tst.au.apgpay.dev/bezel/loan-statements" \
  -H "Authorization: Bearer $API_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "loanId": "<useLoanIdFromSeed>",
  "type": "LstmtCmdCreate"
}'
Credit goes back where it came from. When earlier statements were in credit and that credit paid part of the cancelled statement, it is returned to them, so the next statement can draw on it instead.