# cancelOutgoingPayment

## Overview

Cancels a **DRAFT** outgoing payment, transitioning the `OutgoingPayment` from DRAFT to CANCELLED. Cancellation discards an unposted payment and its draft settlement allocations without ever touching the general ledger. Only DRAFT payments can be cancelled — a POSTED payment must be reversed with [reverseOutgoingPayment](./reverseOutgoingPayment.md) so its journal entry is properly backed out and its settled items re-opened. `id` is the OutgoingPayment id.

## Modules Commands Used

- [account-payable] cancelOutgoingPayment

## Exception Handling

| Error Code | Description |
| --- | --- |
| ACCOUNT_PAYABLE_OUTGOING_PAYMENT_NOT_FOUND | No outgoing payment exists for the given ID. |
| ACCOUNT_PAYABLE_OUTGOING_PAYMENT_INVALID_STATUS | The payment is not in DRAFT status; only DRAFT payments can be cancelled. |
