# Cancel it before it settles

[Cancel or refund a payment](https://devportal.qa.winkpg.io/docs/decide/cancel-or-refund-a-payment.md): Whether undoing a payment is a void, a reversal, or a refund, and what each one does to the money and to your records.

A void or a reversal keeps the payment out of the batch, so the money never leaves the customer's account.

**Your answers so far**

- How did the customer pay? By card.
- Has the payment settled? No. It's authorized or captured, and its batch hasn't closed.
- Are you canceling all of it? Yes. The whole payment shouldn't happen.

**What to build**

Send the cancel the transaction offers: a Void or a Reversal, on the operations endpoint. The platform normally offers one of the two for a given transaction, depending on the merchant's processor. Both change the original transaction rather than creating a new one, and the response confirms the operation was applied, not just queued.

**Worth knowing**

- Confirm the operation is in the transaction's allowedActions list before you send it. The processor, its reversal window, and the merchant's own settings all change that list, and none of them is visible from your side.
- A batch can close between your read and your request. The refusal is a 409 with OPERATION_NOT_ALLOWED_IN_STATE, and it carries the current allowed actions, so read them off the error and send one of those.
- A reversal sends a message to the processor, so it can be refused. Read the transaction back when you need the processor's own answer.

**Where to go next**

- [Refund or void a payment](https://devportal.qa.winkpg.io/docs/blueprints/refund-or-void-a-payment.md)
- [Refunds, voids, and reversals](https://devportal.qa.winkpg.io/docs/guides/refunds-voids-and-reversals.md)
- [Run an operation on a transaction](https://devportal.qa.winkpg.io/docs/api/transactionOperationsExecuteOperation.md)

- [Start over](https://devportal.qa.winkpg.io/docs/decide/cancel-or-refund-a-payment.md): go back to the first question.

## See also

- [All documentation](https://devportal.qa.winkpg.io/llms.txt): the machine-readable index of every public page on this site.
