Skip to main content
PUT
/
api
/
v2
/
subscriptions
/
{subReferenceId}
/
recurring-amount
Update Recurring Amount
curl --request PUT \
  --url https://sandbox.cashfree.com/api/v2/subscriptions/{subReferenceId}/recurring-amount \
  --header 'Content-Type: application/json' \
  --header 'X-Client-Id: <x-client-id>' \
  --header 'X-Client-Secret: <x-client-secret>' \
  --data '{
  "amount": 4.99
}'
import requests

url = "https://sandbox.cashfree.com/api/v2/subscriptions/{subReferenceId}/recurring-amount"

payload = { "amount": 4.99 }
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({amount: 4.99})
};

fetch('https://sandbox.cashfree.com/api/v2/subscriptions/{subReferenceId}/recurring-amount', 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/{subReferenceId}/recurring-amount",
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([
'amount' => 4.99
]),
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/{subReferenceId}/recurring-amount"

payload := strings.NewReader("{\n \"amount\": 4.99\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/{subReferenceId}/recurring-amount")
.header("X-Client-Id", "<x-client-id>")
.header("X-Client-Secret", "<x-client-secret>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 4.99\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://sandbox.cashfree.com/api/v2/subscriptions/{subReferenceId}/recurring-amount")

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 \"amount\": 4.99\n}"

response = http.request(request)
puts response.read_body
{
  "status": "OK",
  "message": "Recurring Amount Updated"
}
{
"status": "ERROR",
"subCode": "400",
"message": "Recurring amount update is valid only for Periodic Subscriptions"
}
{
"status": "ERROR",
"message": "Server encountered an unexpected condition."
}

Headers

X-Client-Id
string
required

Client ID provided by Cashfree.

Example:

"144436e71d659a"

X-Client-Secret
string
required

Client Secret provided by Cashfree.

Example:

"TEST365fd19c"

Path Parameters

subReferenceId
integer
required

The reference ID of the subscription whose recurring amount is to be updated.

Example:

113598

Body

application/json
amount
number

The new recurring amount for the subscription.

Example:

4.99

Response

Successful update of the recurring amount.