---
updatedAt: 2026-04-06T17:32:39.000Z
agentTools:
  projectIndex: https://docs.pagar.me/v4/llms.txt
---

# Cancelando uma assinatura

Para cancelar uma assinatura você deve utilizar a rota /subscriptions/:id/cancel

> ❗️ Atenção: Essa versão de API será descontinuada
>
> Essa versão da API Pagar.me já não é mais atualizada e, em breve, deixará de funcionar. Para que sua loja possa vender sem problemas, você precisa realizar sua integração usando a versão mais recente da nossa API, a V5.
>
> No canto superior esquerdo da tela é indicado qual versão da documentação você está vendo. Clique na seta onde indica a versão e altere para a V5 para acessar a documentação.
>
> Se você já é cliente, precisa realizar obrigatoriamente a migração para a versão V5.
>
> Em caso de dúvidas, basta entrar em contato com o nosso time de atendimento através do e-mail, enviando a sua dúvida para <relacionamento@pagar.me> e por telefone, ligando para 4004-1330. Se você já é cliente pode também entrar em contato através do chat dentro da sua Dashboard.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "api-settings",
    "version": "4"
  },
  "servers": [
    {
      "url": "https://api.pagar.me/1"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "x-default": "",
        "type": "apiKey",
        "name": "api_key",
        "in": "query"
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/subscriptions/{subscription_id}/cancel": {
      "post": {
        "summary": "Cancelando uma assinatura",
        "description": "Para cancelar uma assinatura você deve utilizar a rota /subscriptions/:id/cancel",
        "operationId": "cancelando-uma-assinatura",
        "parameters": [
          {
            "name": "subscription_id",
            "in": "path",
            "description": "ID da assinatura a ser cancelada",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n  \"object\": \"subscription\",\n  \"plan\": {\n    \"object\": \"plan\",\n    \"id\": 166231,\n    \"amount\": 10000,\n    \"days\": 30,\n    \"name\": \"The Pro Plan\",\n    \"trial_days\": 0,\n    \"date_created\": \"2017-06-19T11:55:24.273Z\",\n    \"payment_methods\": [\n      \"boleto\",\n      \"credit_card\"\n    ],\n    \"color\": null,\n    \"charges\": null,\n    \"installments\": 1,\n    \"invoice_reminder\": null\n  },\n  \"id\": 205880,\n  \"current_transaction\": {\n    \"object\": \"transaction\",\n    \"status\": \"paid\",\n    \"refuse_reason\": null,\n    \"status_reason\": \"acquirer\",\n    \"acquirer_response_code\": \"0000\",\n    \"acquirer_name\": \"pagarme\",\n    \"acquirer_id\": \"56f9d019decf72cc70055d58\",\n    \"authorization_code\": \"34097\",\n    \"soft_descriptor\": null,\n    \"tid\": 1629199,\n    \"nsu\": 1629199,\n    \"date_created\": \"2017-06-19T12:24:01.916Z\",\n    \"date_updated\": \"2017-06-19T12:24:02.484Z\",\n    \"amount\": 10000,\n    \"authorized_amount\": 10000,\n    \"paid_amount\": 10000,\n    \"refunded_amount\": 0,\n    \"installments\": 1,\n    \"id\": 1629199,\n    \"cost\": 50,\n    \"card_holder_name\": \"Aardvark da Silva\",\n    \"card_last_digits\": \"4242\",\n    \"card_first_digits\": \"424242\",\n    \"card_brand\": \"visa\",\n    \"card_pin_mode\": null,\n    \"postback_url\": null,\n    \"payment_method\": \"credit_card\",\n    \"capture_method\": \"ecommerce\",\n    \"antifraud_score\": null,\n    \"boleto_url\": null,\n    \"boleto_barcode\": null,\n    \"boleto_expiration_date\": null,\n    \"referer\": \"api_key\",\n    \"ip\": \"189.8.94.42\",\n    \"subscription_id\": 205880,\n    \"split_rules\": null,\n    \"metadata\": {},\n    \"antifraud_metadata\": {}\n  },\n  \"postback_url\": null,\n  \"payment_method\": \"credit_card\",\n  \"card_brand\": \"visa\",\n  \"card_last_digits\": \"4242\",\n  \"current_period_start\": \"2017-06-19T12:24:01.900Z\",\n  \"current_period_end\": \"2017-07-19T12:24:01.900Z\",\n  \"charges\": 0,\n  \"status\": \"canceled\",\n  \"date_created\": \"2017-06-19T12:24:02.463Z\",\n  \"phone\": null,\n  \"address\": null,\n  \"customer\": {\n    \"object\": \"customer\",\n    \"id\": 198874,\n    \"external_id\": null,\n    \"type\": null,\n    \"country\": null,\n    \"document_number\": \"03427857530\",\n    \"document_type\": \"cpf\",\n    \"name\": \"Aardvark Silva\",\n    \"email\": \"aardvark.silva@emailg.com\",\n    \"phones\": null,\n    \"born_at\": null,\n    \"birthday\": null,\n    \"gender\": null,\n    \"date_created\": \"2017-06-19T12:12:32.020Z\",\n    \"documents\": []\n  },\n  \"card\": {\n    \"object\": \"card\",\n    \"id\": \"card_cj41mpuhc01bb3f6d8exeo072\",\n    \"date_created\": \"2017-06-17T18:41:10.801Z\",\n    \"date_updated\": \"2017-06-17T18:41:11.257Z\",\n    \"brand\": \"visa\",\n    \"holder_name\": \"Aardvark da Silva\",\n    \"first_digits\": \"424242\",\n    \"last_digits\": \"4242\",\n    \"country\": \"AR\",\n    \"fingerprint\": \"SK+CuBxPYsE7\",\n    \"valid\": true,\n    \"expiration_date\": \"1220\"\n  },\n  \"metadata\": null,\n  \"settled_charges\": null\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "example": "subscription"
                    },
                    "plan": {
                      "type": "object",
                      "properties": {
                        "object": {
                          "type": "string",
                          "example": "plan"
                        },
                        "id": {
                          "type": "integer",
                          "example": 166231,
                          "default": 0
                        },
                        "amount": {
                          "type": "integer",
                          "example": 10000,
                          "default": 0
                        },
                        "days": {
                          "type": "integer",
                          "example": 30,
                          "default": 0
                        },
                        "name": {
                          "type": "string",
                          "example": "The Pro Plan"
                        },
                        "trial_days": {
                          "type": "integer",
                          "example": 0,
                          "default": 0
                        },
                        "date_created": {
                          "type": "string",
                          "example": "2017-06-19T11:55:24.273Z"
                        },
                        "payment_methods": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "example": "boleto"
                          }
                        },
                        "color": {},
                        "charges": {},
                        "installments": {
                          "type": "integer",
                          "example": 1,
                          "default": 0
                        },
                        "invoice_reminder": {}
                      }
                    },
                    "id": {
                      "type": "integer",
                      "example": 205880,
                      "default": 0
                    },
                    "current_transaction": {
                      "type": "object",
                      "properties": {
                        "object": {
                          "type": "string",
                          "example": "transaction"
                        },
                        "status": {
                          "type": "string",
                          "example": "paid"
                        },
                        "refuse_reason": {},
                        "status_reason": {
                          "type": "string",
                          "example": "acquirer"
                        },
                        "acquirer_response_code": {
                          "type": "string",
                          "example": "0000"
                        },
                        "acquirer_name": {
                          "type": "string",
                          "example": "pagarme"
                        },
                        "acquirer_id": {
                          "type": "string",
                          "example": "56f9d019decf72cc70055d58"
                        },
                        "authorization_code": {
                          "type": "string",
                          "example": "34097"
                        },
                        "soft_descriptor": {},
                        "tid": {
                          "type": "integer",
                          "example": 1629199,
                          "default": 0
                        },
                        "nsu": {
                          "type": "integer",
                          "example": 1629199,
                          "default": 0
                        },
                        "date_created": {
                          "type": "string",
                          "example": "2017-06-19T12:24:01.916Z"
                        },
                        "date_updated": {
                          "type": "string",
                          "example": "2017-06-19T12:24:02.484Z"
                        },
                        "amount": {
                          "type": "integer",
                          "example": 10000,
                          "default": 0
                        },
                        "authorized_amount": {
                          "type": "integer",
                          "example": 10000,
                          "default": 0
                        },
                        "paid_amount": {
                          "type": "integer",
                          "example": 10000,
                          "default": 0
                        },
                        "refunded_amount": {
                          "type": "integer",
                          "example": 0,
                          "default": 0
                        },
                        "installments": {
                          "type": "integer",
                          "example": 1,
                          "default": 0
                        },
                        "id": {
                          "type": "integer",
                          "example": 1629199,
                          "default": 0
                        },
                        "cost": {
                          "type": "integer",
                          "example": 50,
                          "default": 0
                        },
                        "card_holder_name": {
                          "type": "string",
                          "example": "Aardvark da Silva"
                        },
                        "card_last_digits": {
                          "type": "string",
                          "example": "4242"
                        },
                        "card_first_digits": {
                          "type": "string",
                          "example": "424242"
                        },
                        "card_brand": {
                          "type": "string",
                          "example": "visa"
                        },
                        "card_pin_mode": {},
                        "postback_url": {},
                        "payment_method": {
                          "type": "string",
                          "example": "credit_card"
                        },
                        "capture_method": {
                          "type": "string",
                          "example": "ecommerce"
                        },
                        "antifraud_score": {},
                        "boleto_url": {},
                        "boleto_barcode": {},
                        "boleto_expiration_date": {},
                        "referer": {
                          "type": "string",
                          "example": "api_key"
                        },
                        "ip": {
                          "type": "string",
                          "example": "189.8.94.42"
                        },
                        "subscription_id": {
                          "type": "integer",
                          "example": 205880,
                          "default": 0
                        },
                        "split_rules": {},
                        "metadata": {
                          "type": "object",
                          "properties": {}
                        },
                        "antifraud_metadata": {
                          "type": "object",
                          "properties": {}
                        }
                      }
                    },
                    "postback_url": {},
                    "payment_method": {
                      "type": "string",
                      "example": "credit_card"
                    },
                    "card_brand": {
                      "type": "string",
                      "example": "visa"
                    },
                    "card_last_digits": {
                      "type": "string",
                      "example": "4242"
                    },
                    "current_period_start": {
                      "type": "string",
                      "example": "2017-06-19T12:24:01.900Z"
                    },
                    "current_period_end": {
                      "type": "string",
                      "example": "2017-07-19T12:24:01.900Z"
                    },
                    "charges": {
                      "type": "integer",
                      "example": 0,
                      "default": 0
                    },
                    "status": {
                      "type": "string",
                      "example": "canceled"
                    },
                    "date_created": {
                      "type": "string",
                      "example": "2017-06-19T12:24:02.463Z"
                    },
                    "phone": {},
                    "address": {},
                    "customer": {
                      "type": "object",
                      "properties": {
                        "object": {
                          "type": "string",
                          "example": "customer"
                        },
                        "id": {
                          "type": "integer",
                          "example": 198874,
                          "default": 0
                        },
                        "external_id": {},
                        "type": {},
                        "country": {},
                        "document_number": {
                          "type": "string",
                          "example": "03427857530"
                        },
                        "document_type": {
                          "type": "string",
                          "example": "cpf"
                        },
                        "name": {
                          "type": "string",
                          "example": "Aardvark Silva"
                        },
                        "email": {
                          "type": "string",
                          "example": "aardvark.silva@emailg.com"
                        },
                        "phones": {},
                        "born_at": {},
                        "birthday": {},
                        "gender": {},
                        "date_created": {
                          "type": "string",
                          "example": "2017-06-19T12:12:32.020Z"
                        },
                        "documents": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {}
                          }
                        }
                      }
                    },
                    "card": {
                      "type": "object",
                      "properties": {
                        "object": {
                          "type": "string",
                          "example": "card"
                        },
                        "id": {
                          "type": "string",
                          "example": "card_cj41mpuhc01bb3f6d8exeo072"
                        },
                        "date_created": {
                          "type": "string",
                          "example": "2017-06-17T18:41:10.801Z"
                        },
                        "date_updated": {
                          "type": "string",
                          "example": "2017-06-17T18:41:11.257Z"
                        },
                        "brand": {
                          "type": "string",
                          "example": "visa"
                        },
                        "holder_name": {
                          "type": "string",
                          "example": "Aardvark da Silva"
                        },
                        "first_digits": {
                          "type": "string",
                          "example": "424242"
                        },
                        "last_digits": {
                          "type": "string",
                          "example": "4242"
                        },
                        "country": {
                          "type": "string",
                          "example": "AR"
                        },
                        "fingerprint": {
                          "type": "string",
                          "example": "SK+CuBxPYsE7"
                        },
                        "valid": {
                          "type": "boolean",
                          "example": true,
                          "default": true
                        },
                        "expiration_date": {
                          "type": "string",
                          "example": "1220"
                        }
                      }
                    },
                    "metadata": {},
                    "settled_charges": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          }
        },
        "deprecated": false,
        "x-readme": {
          "code-samples": [
            {
              "language": "curl",
              "code": "curl -X POST https://api.pagar.me/1/subscriptions/205880/cancel -H 'content-type: application/json' -d '{\n    \"api_key\": \"SUA_API_KEY\"\n}'"
            },
            {
              "language": "ruby",
              "code": "require 'pagarme'\n\nPagarMe.api_key = \"SUA_API_KEY\"\n\nsubscription = PagarMe::Subscription.find_by_id(\"205880\")\n\nsubscription.cancel"
            },
            {
              "language": "php",
              "code": "<?php\nrequire(\"vendor/autoload.php\");\n$pagarme = new PagarMe\\Client('SUA_CHAVE_DE_API');\n\n$canceledSubscription = $pagarme->subscriptions()->cancel([\n  'id' => 12345\n]);\n"
            },
            {
              "language": "csharp",
              "code": "PagarMeService.DefaultApiKey = \"SUA_API_KEY\";\nvar subscription = PagarMeService.GetDefaultService().Subscriptions.Find(\"205880\");\nsubscription.Cancel();"
            },
            {
              "language": "java",
              "code": "import me.pagar.model.PagarMe;\nimport me.pagar.model.PagarMeException;\nimport me.pagar.model.Subscription;\n\nPagarMe.init(\"SUA_API_KEY\");\n\nSubscription subscription = new Subscription().find(\"205880\");\nsubscription.cancel();"
            },
            {
              "language": "javascript",
              "code": "const pagarme = require('pagarme')\n  \npagarme.client.connect({ api_key: 'SUA_API_KEY' })\n  .then(client => client.subscriptions.cancel({ id: '205880' }))\n  .then(subscription => console.log(subscription))",
              "name": "JS"
            },
            {
              "language": "python",
              "code": "import pagarme\n\npagarme.authentication_key('SUA_API_KEY')\n\nsubscription = pagarme.subscription.cancel(\"ID_DA_SUBSCRIPTION\")\n\nprint (subscription)"
            }
          ],
          "samples-languages": [
            "curl",
            "ruby",
            "php",
            "csharp",
            "java",
            "javascript",
            "python"
          ]
        }
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true
}
```