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

# Update Charge Status

> Use this API to update the status of the charge from PENDING to SUCCESS or FAILED. This is applicable only in the test environment.



## OpenAPI

````yaml put /api/v2/subscriptions/charge/{paymentId}/simulate
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/charge/{paymentId}/simulate:
    put:
      tags:
        - Subscription
      summary: Update Charge Status
      description: >-
        Use this API to update the status of the charge from PENDING to SUCCESS
        or FAILED. This is applicable only in the test environment.
      operationId: updateChargeStatus
      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: paymentId
          in: path
          required: true
          schema:
            type: integer
            description: The ID of the payment whose status is being updated.
            example: 120322
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                status:
                  type: string
                  description: The new status of the payment.
                  enum:
                    - SUCCESS
                    - FAILED
                  example: SUCCESS
      responses:
        '200':
          description: Successful update of the charge status.
          content:
            application/json:
              examples:
                Update Charge Success:
                  value:
                    status: OK
                    message: Update Charge - Simulator
                    chargeResponse:
                      paymentId: 120322
                      status: SUCCESS
        '400':
          description: Bad request due to invalid parameters or status change.
          content:
            application/json:
              examples:
                Invalid Status Change:
                  value:
                    status: ERROR
                    subCode: '400'
                    message: >-
                      Charge status cannot be changed from INITIALIZED to
                      SUCCESS
                Repeating Status Change:
                  value:
                    status: ERROR
                    subCode: '400'
                    message: Charge status cannot be changed from SUCCESS to SUCCESS
                Invalid Payment ID:
                  value:
                    status: ERROR
                    subCode: '400'
                    message: 'Payment does not exist for id: 121322'
        '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.

````