---
updatedAt: 2026-09-17T16:50:48.000Z
agentTools:
  projectIndex: https://docs.dlocal.com/llms.txt
---

# Cancel pending payment

Cancel pending payments for alternative payment methods (APMs).


<Callout icon="⚠️" theme="warning">
  ### Cancelling REDIRECT payments before a payment method is selected

  This endpoint can also be used to cancel a payment created with the **REDIRECT** flow while it is still in **PENDING** status, even if the payer has not completed checkout yet, for example when no `payment_method_id` was specified at creation and the payer has not selected how to pay.

  No additional parameters are required. Use the same payment_id returned when the payment was created.
</Callout>

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Payins",
    "version": "2.1"
  },
  "servers": [
    {
      "url": "https://api.dlocal.com"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "apiKey",
        "name": "X-Date",
        "in": "header",
        "x-default": ""
      },
      "sec1": {
        "type": "apiKey",
        "name": "X-Login",
        "in": "header",
        "x-default": ""
      },
      "sec2": {
        "type": "apiKey",
        "name": "X-Trans-Key",
        "in": "header",
        "x-default": ""
      },
      "sec3": {
        "type": "apiKey",
        "name": "Content-Type",
        "in": "header",
        "x-default": "application/json"
      },
      "sec4": {
        "type": "apiKey",
        "name": "X-Version",
        "in": "header",
        "x-default": "2.1"
      },
      "sec5": {
        "type": "apiKey",
        "name": "User-Agent",
        "in": "header",
        "x-default": ""
      },
      "sec6": {
        "type": "apiKey",
        "name": "Authorization",
        "in": "header",
        "x-default": ""
      }
    }
  },
  "security": [
    {
      "sec0": [],
      "sec1": [],
      "sec2": [],
      "sec3": [],
      "sec4": [],
      "sec5": [],
      "sec6": []
    }
  ],
  "paths": {
    "/payments/{payment_id}/cancel": {
      "post": {
        "tags": [
          "Payments"
        ],
        "summary": "Cancel pending payment",
        "description": "Cancel pending payments for alternative payment methods (APMs).\n",
        "operationId": "cancel-alternative-payment",
        "parameters": [
          {
            "name": "payment_id",
            "in": "path",
            "description": "The payment ID.",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n    \"id\": \"D-4-f1500792-7527-4a0e-86ef-3a9472b63f21\",\n    \"amount\": 1000,\n    \"currency\": \"MXN\",\n    \"payment_method_id\": \"OX\",\n    \"payment_method_type\": \"TICKET\",\n    \"payment_method_flow\": \"DIRECT\",\n    \"country\": \"MX\",\n    \"created_date\": \"2020-09-14T19:11:48.000+0000\",\n    \"status\": \"CANCELLED\",\n    \"status_detail\": \"The payment was cancelled.\",\n    \"status_code\": \"400\",\n    \"order_id\": \"23796c17-2cc5-4fbb-86b5-10da0859a282\",\n    \"description\": \"test\",\n    \"notification_url\": \"http://conductor.sandbox.internal/robot-server/rest/generic/notification/new\"\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "example": "D-4-f1500792-7527-4a0e-86ef-3a9472b63f21"
                    },
                    "amount": {
                      "type": "number",
                      "example": 1000,
                      "default": 0,
                      "format": "float"
                    },
                    "currency": {
                      "type": "string",
                      "example": "MXN"
                    },
                    "payment_method_id": {
                      "type": "string",
                      "example": "OX"
                    },
                    "payment_method_type": {
                      "type": "string",
                      "example": "TICKET"
                    },
                    "payment_method_flow": {
                      "type": "string",
                      "example": "DIRECT"
                    },
                    "country": {
                      "type": "string",
                      "example": "MX"
                    },
                    "created_date": {
                      "type": "string",
                      "example": "2020-09-14T19:11:48.000+0000"
                    },
                    "status": {
                      "type": "string",
                      "example": "CANCELLED"
                    },
                    "status_detail": {
                      "type": "string",
                      "example": "The payment was cancelled."
                    },
                    "status_code": {
                      "type": "string",
                      "example": "400"
                    },
                    "order_id": {
                      "type": "string",
                      "example": "23796c17-2cc5-4fbb-86b5-10da0859a282"
                    },
                    "description": {
                      "type": "string",
                      "example": "test"
                    },
                    "notification_url": {
                      "type": "string",
                      "example": "http://conductor.sandbox.internal/robot-server/rest/generic/notification/new"
                    }
                  }
                }
              }
            }
          }
        },
        "deprecated": false,
        "x-readme": {
          "code-samples": [
            {
              "language": "shell",
              "code": "curl -X POST \\\n   -H 'X-Date: {X-Date}' \\\n   -H 'X-Login: {X-Login}' \\\n   -H 'X-Trans-Key: {X-Trans-Key}' \\\n   -H 'Content-Type: application/json' \\\n   -H 'X-Version: 2.1' \\\n   -H 'User-Agent: MerchantTest / 1.0 ' \\\n   -H 'Authorization: V2-HMAC-SHA256, Signature: {Signature}' \\\n   -d '{body}'\n   https://api.dlocal.com/payments/D-4-f1500792-7527-4a0e-86ef-3a9472b63f21/cancel"
            }
          ],
          "samples-languages": [
            "shell"
          ]
        }
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": false,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true
}
```