Skip to main content
PUT
/
api
/
v2
/
subscriptions
/
charge
/
{paymentId}
/
simulate
Update Charge Status
curl --request PUT \
  --url https://sandbox.cashfree.com/api/v2/subscriptions/charge/{paymentId}/simulate \
  --header 'Content-Type: application/json' \
  --header 'X-Client-Id: <x-client-id>' \
  --header 'X-Client-Secret: <x-client-secret>' \
  --data '
{
  "status": "SUCCESS"
}
'
import requests

url = "https://sandbox.cashfree.com/api/v2/subscriptions/charge/{paymentId}/simulate"

payload = { "status": "SUCCESS" }
headers = {
    "X-Client-Id": "<x-client-id>",
    "X-Client-Secret": "<x-client-secret>",
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'PUT',
  headers: {
    'X-Client-Id': '<x-client-id>',
    'X-Client-Secret': '<x-client-secret>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({status: 'SUCCESS'})
};

fetch('https://sandbox.cashfree.com/api/v2/subscriptions/charge/{paymentId}/simulate', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://sandbox.cashfree.com/api/v2/subscriptions/charge/{paymentId}/simulate",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => json_encode([
    'status' => 'SUCCESS'
  ]),
  CURLOPT_HTTPHEADER => [
    "Content-Type: application/json",
    "X-Client-Id: <x-client-id>",
    "X-Client-Secret: <x-client-secret>"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://sandbox.cashfree.com/api/v2/subscriptions/charge/{paymentId}/simulate"

	payload := strings.NewReader("{\n  \"status\": \"SUCCESS\"\n}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("X-Client-Id", "<x-client-id>")
	req.Header.Add("X-Client-Secret", "<x-client-secret>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.put("https://sandbox.cashfree.com/api/v2/subscriptions/charge/{paymentId}/simulate")
  .header("X-Client-Id", "<x-client-id>")
  .header("X-Client-Secret", "<x-client-secret>")
  .header("Content-Type", "application/json")
  .body("{\n  \"status\": \"SUCCESS\"\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://sandbox.cashfree.com/api/v2/subscriptions/charge/{paymentId}/simulate")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["X-Client-Id"] = '<x-client-id>'
request["X-Client-Secret"] = '<x-client-secret>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"status\": \"SUCCESS\"\n}"

response = http.request(request)
puts response.read_body
{ "status": "OK", "message": "Update Charge - Simulator", "chargeResponse": { "paymentId": 120322, "status": "SUCCESS" } }

Headers

X-Client-Id
string
required

Client ID provided by Cashfree.

Example:

"asdf1234"

X-Client-Secret
string
required

Client Secret provided by Cashfree.

Example:

"qwer9876"

Path Parameters

paymentId
integer
required

The ID of the payment whose status is being updated.

Example:

120322

Body

application/json
status
enum<string>

The new status of the payment.

Available options:
SUCCESS,
FAILED
Example:

"SUCCESS"

Response

Successful update of the charge status.