cURL
curl --request PUT 'https://api.integrateledger.com/v1/plans/starter' \
-H "Authorization: Bearer $LEDGER_API_KEY" \
-H 'Content-Type: application/json' \
--data '{"name":"Starter","monthlyCredits":200,"monthlyPriceCents":2900}'import os
from ledger_sdk import Ledger
ledger = Ledger(api_key=os.environ["LEDGER_API_KEY"])
ledger.update_plan("starter", name="Starter", monthly_credits=200, monthly_price_cents=2900)import { Ledger } from "@ledger/sdk";
const ledger = new Ledger({ apiKey: process.env.LEDGER_API_KEY ?? "" });
await ledger.updatePlan({ id: "starter", body: { name: "Starter", monthlyCredits: 200, monthlyPriceCents: 2900 } });const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', monthlyCredits: 123, monthlyPriceCents: 1073741823})
};
fetch('https://api.integrateledger.com/v1/plans/{id}', 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://api.integrateledger.com/v1/plans/{id}",
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([
'name' => '<string>',
'monthlyCredits' => 123,
'monthlyPriceCents' => 1073741823
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://api.integrateledger.com/v1/plans/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"monthlyCredits\": 123,\n \"monthlyPriceCents\": 1073741823\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.integrateledger.com/v1/plans/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"monthlyCredits\": 123,\n \"monthlyPriceCents\": 1073741823\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.integrateledger.com/v1/plans/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"monthlyCredits\": 123,\n \"monthlyPriceCents\": 1073741823\n}"
response = http.request(request)
puts response.read_body{
"item": {
"id": "<string>",
"name": "<string>",
"monthlyCredits": 123,
"monthlyPriceCents": 1073741823,
"stripeSyncStatus": "pending"
},
"changed": true,
"stripeSync": "synced"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Plans
Update a plan
Update a plan with its complete editable body. A changed plan creates a new version for future Checkouts.
PUT
/
v1
/
plans
/
{id}
cURL
curl --request PUT 'https://api.integrateledger.com/v1/plans/starter' \
-H "Authorization: Bearer $LEDGER_API_KEY" \
-H 'Content-Type: application/json' \
--data '{"name":"Starter","monthlyCredits":200,"monthlyPriceCents":2900}'import os
from ledger_sdk import Ledger
ledger = Ledger(api_key=os.environ["LEDGER_API_KEY"])
ledger.update_plan("starter", name="Starter", monthly_credits=200, monthly_price_cents=2900)import { Ledger } from "@ledger/sdk";
const ledger = new Ledger({ apiKey: process.env.LEDGER_API_KEY ?? "" });
await ledger.updatePlan({ id: "starter", body: { name: "Starter", monthlyCredits: 200, monthlyPriceCents: 2900 } });const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', monthlyCredits: 123, monthlyPriceCents: 1073741823})
};
fetch('https://api.integrateledger.com/v1/plans/{id}', 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://api.integrateledger.com/v1/plans/{id}",
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([
'name' => '<string>',
'monthlyCredits' => 123,
'monthlyPriceCents' => 1073741823
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://api.integrateledger.com/v1/plans/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"monthlyCredits\": 123,\n \"monthlyPriceCents\": 1073741823\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.integrateledger.com/v1/plans/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"monthlyCredits\": 123,\n \"monthlyPriceCents\": 1073741823\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.integrateledger.com/v1/plans/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"monthlyCredits\": 123,\n \"monthlyPriceCents\": 1073741823\n}"
response = http.request(request)
puts response.read_body{
"item": {
"id": "<string>",
"name": "<string>",
"monthlyCredits": 123,
"monthlyPriceCents": 1073741823,
"stripeSyncStatus": "pending"
},
"changed": true,
"stripeSync": "synced"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Updates one current plan. Supply the full editable body:
name, positive monthlyCredits, and monthlyPriceCents in USD cents. The id stays in the URL. Repeating the same values returns changed: false; changed values return changed: true and create a new plan version.
New customers use the new version for Checkout. Existing subscriptions retain the version they already reference; an update does not move or rebill them. A paid version syncs to the selected environment’s Stripe account and reports stripeSync. Changing the price to 0 creates a free version that can be assigned without Checkout. An unknown or archived ID returns 404 not_found, and invalid amounts return 400 invalid_request.
Use Get a plan first if you need the current editable values, and see Catalog for versioning and Upgrade a paid plan for changing an active customer’s subscription.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Required string length:
1 - 100Pattern:
^[a-zA-Z0-9_-]+$Body
application/json