cURL
curl --request PUT 'https://api.integrateledger.com/v1/add-ons/extra_credits' \
-H "Authorization: Bearer $LEDGER_API_KEY" \
-H 'Content-Type: application/json' \
--data '{"name":"Extra credits","type":"credit_pack","creditAmount":100,"priceCents":900}'import os
from ledger_sdk import Ledger
ledger = Ledger(api_key=os.environ["LEDGER_API_KEY"])
ledger.update_add_on("extra_credits", name="Extra credits", credit_amount=100, price_cents=900)import { Ledger } from "@ledger/sdk";
const ledger = new Ledger({ apiKey: process.env.LEDGER_API_KEY ?? "" });
await ledger.updateAddOn({ id: "extra_credits", body: { name: "Extra credits", type: "credit_pack", creditAmount: 100, priceCents: 900 } });const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', type: 'credit_pack', creditAmount: 123, priceCents: 123})
};
fetch('https://api.integrateledger.com/v1/add-ons/{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/add-ons/{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>',
'type' => 'credit_pack',
'creditAmount' => 123,
'priceCents' => 123
]),
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/add-ons/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"type\": \"credit_pack\",\n \"creditAmount\": 123,\n \"priceCents\": 123\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/add-ons/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"type\": \"credit_pack\",\n \"creditAmount\": 123,\n \"priceCents\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.integrateledger.com/v1/add-ons/{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 \"type\": \"credit_pack\",\n \"creditAmount\": 123,\n \"priceCents\": 123\n}"
response = http.request(request)
puts response.read_body{
"item": {
"id": "<string>",
"name": "<string>",
"type": "credit_pack",
"creditAmount": 123,
"priceCents": 123
},
"changed": true
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Add-ons
Update an add-on
Update a credit pack with its complete editable body.
PUT
/
v1
/
add-ons
/
{id}
cURL
curl --request PUT 'https://api.integrateledger.com/v1/add-ons/extra_credits' \
-H "Authorization: Bearer $LEDGER_API_KEY" \
-H 'Content-Type: application/json' \
--data '{"name":"Extra credits","type":"credit_pack","creditAmount":100,"priceCents":900}'import os
from ledger_sdk import Ledger
ledger = Ledger(api_key=os.environ["LEDGER_API_KEY"])
ledger.update_add_on("extra_credits", name="Extra credits", credit_amount=100, price_cents=900)import { Ledger } from "@ledger/sdk";
const ledger = new Ledger({ apiKey: process.env.LEDGER_API_KEY ?? "" });
await ledger.updateAddOn({ id: "extra_credits", body: { name: "Extra credits", type: "credit_pack", creditAmount: 100, priceCents: 900 } });const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', type: 'credit_pack', creditAmount: 123, priceCents: 123})
};
fetch('https://api.integrateledger.com/v1/add-ons/{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/add-ons/{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>',
'type' => 'credit_pack',
'creditAmount' => 123,
'priceCents' => 123
]),
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/add-ons/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"type\": \"credit_pack\",\n \"creditAmount\": 123,\n \"priceCents\": 123\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/add-ons/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"type\": \"credit_pack\",\n \"creditAmount\": 123,\n \"priceCents\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.integrateledger.com/v1/add-ons/{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 \"type\": \"credit_pack\",\n \"creditAmount\": 123,\n \"priceCents\": 123\n}"
response = http.request(request)
puts response.read_body{
"item": {
"id": "<string>",
"name": "<string>",
"type": "credit_pack",
"creditAmount": 123,
"priceCents": 123
},
"changed": true
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Updates one active credit pack by its URL
id. Send the complete editable body: name, type: "credit_pack", positive creditAmount, and positive priceCents in USD cents. The response contains the current item and changed; unchanged values return changed: false.
New Checkouts use the updated value. If a purchase is still pending_checkout, changing its credit amount or price returns 409 purchase_pending. Complete the payment or wait for Stripe’s signed checkout.session.expired event to clear the pending purchase, then retry. A browser cancel redirect alone does not expire the session. If an expired Checkout still blocks the edit, verify the organization’s Stripe webhook subscribes to expiry events and that Ledger received the event. A name-only edit is allowed while Checkout is pending. An unknown or archived ID returns 404 not_found; invalid values return 400 invalid_request.
See Create an add-on for pack setup and Customers for payment and credit timing.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