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

# Cancel Subscription Charge

> Use this API to cancel a transaction that is in the INITIALIZED state.



## OpenAPI

````yaml post /api/v2/subscription/{subReferenceId}/charge/{chargeId}/cancel
openapi: 3.0.0
info:
  title: Cashfree Subscription API
  description: >-
    Create and manage subscriptions and collect recurring payments from
    customers easily with Cashfree Subscriptions.
  version: v2
servers:
  - url: https://sandbox.cashfree.com
    description: Sandbox server
  - url: https://api.cashfree.com
    description: Production server
security: []
externalDocs:
  url: https://docs.cashfree.com/reference/postman-collection-1
  description: This url will have the information of all the APIs.
paths:
  /api/v2/subscription/{subReferenceId}/charge/{chargeId}/cancel:
    post:
      tags:
        - Subscription
      summary: Cancel Subscription Charge
      description: Use this API to cancel a transaction that is in the INITIALIZED state.
      operationId: cancelSubscriptionCharge
      parameters:
        - name: X-Client-Id
          in: header
          required: true
          schema:
            type: string
            description: Client ID provided by Cashfree.
            example: asdf1234
        - name: X-Client-Secret
          in: header
          required: true
          schema:
            type: string
            description: Client Secret provided by Cashfree.
            example: qwer9876
        - name: subReferenceId
          in: path
          required: true
          schema:
            type: integer
            description: The reference ID of the subscription.
            example: 123456
        - name: chargeId
          in: path
          required: true
          schema:
            type: integer
            description: The ID of the charge to be cancelled.
            example: 9876543
      responses:
        '200':
          description: Successful cancellation of the subscription charge.
          content:
            application/json:
              examples:
                Cancel Charge Success:
                  value:
                    status: OK
                    message: Subscription charge cancelled
                    payment:
                      paymentId: 2276563
                      referenceId: 214308920
                      subReferenceId: 5513463
                      cfOrderId: 236286405
                      currency: INR
                      amount: 250
                      cycle: 5
                      status: CANCELLED
                      remarks: null
                      scheduledOn: '2021-09-13'
                      addedOn: '2021-09-09 11:05:19'
                      retryAttempts: 0
                      failureReason: null
        '400':
          description: Bad request due to invalid parameters.
          content:
            application/json:
              examples:
                Invalid Subscription or Charge ID:
                  value:
                    status: ERROR
                    subCode: '400'
                    message: Invalid subscription or charge ID provided.
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    description: Status of the API call.
                    example: ERROR
                  message:
                    type: string
                    description: Error message.
                    example: Server encountered an unexpected condition.

````