> ## 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.

# Charge Subscription

> Charge a specific subscription using the provided subscription reference ID.



## OpenAPI

````yaml post /api/v2/subscriptions/{subReferenceId}/charge
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/subscriptions/{subReferenceId}/charge:
    post:
      tags:
        - Subscription
      summary: Charge Subscription
      description: >-
        Charge a specific subscription using the provided subscription reference
        ID.
      operationId: chargeSubscription
      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 to be charged.
            example: 2596620
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                amount:
                  type: number
                  description: Amount to be charged.
                  example: 1
                scheduledOn:
                  type: string
                  format: date
                  description: Date to schedule the charge.
                  example: '2023-01-20'
                remarks:
                  type: string
                  description: Remarks for the charge.
                  example: Charge Subscription
                merchantTxnId:
                  type: string
                  description: Merchant transaction ID for the charge.
                  example: test-txn-id-888
      responses:
        '200':
          description: Successful charge of the subscription.
          content:
            application/json:
              examples:
                Charge Subscription Success:
                  value:
                    status: OK
                    message: Subscription charge initialized
                    payment:
                      paymentId: 122129
                      cfOrderId: 112234
                      referenceId: null
                      subReferenceId: 110386
                      currency: INR
                      amount: 1
                      cycle: 1
                      status: INITIALIZED
                      addedOn: '2023-01-19 16:49:49'
                      retryAttempts: 0
                      remarks: ''
                      failureReason: ''
                      scheduledOn: '2023-01-20'
                      initiatedOn: '2023-01-19'
                      merchantTxnId: test-txn-id-888
        '400':
          description: Bad request due to invalid parameters or subscription state.
          content:
            application/json:
              examples:
                Future Date Error:
                  value:
                    status: ERROR
                    subCode: '400'
                    message: >-
                      Unable to charge subscription | Invalid Schedule On. Date
                      should be future date
                Subscription Not Active:
                  value:
                    status: ERROR
                    subCode: '400'
                    message: Unable to charge subscription | subscription is not active
                Invalid Charge Amount:
                  value:
                    status: ERROR
                    subCode: '400'
                    message: >-
                      Unable to charge subscription | Cannot charge more than
                      Max Amount of the Subscription
                Invalid Merchant ID:
                  value:
                    status: ERROR
                    subCode: '400'
                    message: >-
                      Unable to charge subscription | MerchantTxnId: testtxnID
                      already exists
                Invalid Merchant ID Format:
                  value:
                    status: ERROR
                    subCode: '400'
                    message: >-
                      Unable to charge subscription | merchantTxnId : allows
                      only alpha numerics,dot,hyphen,underscore
        '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.

````