> ## Documentation Index
> Fetch the complete documentation index at: https://docs.y.uno/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Test in the sandbox first: base URL https://api-sandbox.y.uno (Test Mode in the Dashboard). Production is https://api.y.uno (Live Mode).
> Every API request needs the public-api-key and private-secret-key headers. Get them in the Dashboard at https://dashboard.y.uno/developers (Developers > Credentials); sandbox and production keys are different.
> Send an X-Idempotency-Key (a UUID) when creating payments, refunds and cancels, so retries do not create duplicates.
> Start with the Quickstart (https://docs.y.uno/docs/quickstart.md) and the agent guide (https://docs.y.uno/agents.md). To search these docs from a coding agent, connect the docs MCP server at https://docs.y.uno/mcp.

# Cancel Payments

> Shows how to manually cancel a pending payment using the Cancel Payment endpoint.

In this guide, you will find step-by-step instructions on manually canceling a previously created payment on Yuno.

> [!NOTE]
>
> **Automatic Delayed Cancel**
>
> If you prefer to have Yuno automatically cancel authorizations after a specified delay, you can configure `delayed_cancel_settings` when creating the payment. This helps improve customer experience by automatically releasing held funds. Learn more in the [Cancel and Capture Flow](https://docs.y.uno/docs/payment-features/Cancel-and-capture-flow.md) guide.

> [!WARNING]
>
> **Cancellable Payments**
>
> Only payments with **PENDING** status can be canceled. Check the [Payment status](https://docs.y.uno/docs/basic-concepts/payments-1.md) page for further details regarding the possible payment status.

## Requirements

To cancel a payment, you need to:

* Access your [API credentials](https://docs.y.uno/docs/using-yuno/settings/developers-credentials.md) on the Yuno Dashboard, which consist of:
  * `public-api-key`
  * `private-secret-key`
* Have the payment identification data received after creating the payment using the [Create Payment endpoint](https://docs.y.uno/reference/payments/create-payment.md):
  * `id`: The unique identifier of the payment, obtained from the parameter `id` after creating the payment.
  * `transaction_id`: The unique identifier of the transaction obtained from the parameter `transaction.id` after creating the payment.

> [!NOTE]
>
> **Explore Yuno Postman Collections**
>
> Yuno provides [Postman Collections](https://docs.y.uno/reference/getting-started/postman-collections.md) that you can use to replicate the use cases locally.

## Cancel a payment

You can cancel a payment only if it has the PENDING status. Use the [Cancel Payment endpoint](https://docs.y.uno/reference/payments/cancel-payment.md) to cancel the payment. To identify the payment to be canceled, you need to provide its `id` and the `transaction_id`.

To confirm you have successfully canceled the payment, check if the parameters from the [Cancel Payment endpoint](https://docs.y.uno/reference/payments/cancel-payment.md) response contain the following values:

* `type = CANCEL`
* `status = SUCCEEDED`
* `payment.status = CANCELED`
* `payment.sub_status = CANCELED`

If the response contains the above values, the cancellation was successful.

### Check the payment status

If, for some reason, you need to confirm the payment cancellation:

* Use the [Retrieve Payment by ID](https://docs.y.uno/reference/payments/retrieve-payment-by-id) or [Retrieve Payment by merchant\_order\_id](https://docs.y.uno/reference/payments/retrieve-payment-by-merchant-order-id.md) to get detailed information about the payment.
* Alternatively, set up webhooks to receive notifications for each event. Refer to the [Webhooks](https://docs.y.uno/docs/webhooks/configure-webhooks.md) guide to learn how to configure webhooks in Yuno.

## See also

* [Capture Payments](https://docs.y.uno/docs/direct-integration-use-cases/capture-payments.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.