Skip to main content
PUT
/
subscriptions
/
{external_id}
/
fixed_charges
/
{fixed_charge_code}
Override a fixed charge for a subscription
curl --request PUT \
  --url https://api.getlago.com/api/v1/subscriptions/{external_id}/fixed_charges/{fixed_charge_code} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "fixed_charge": {
    "invoice_display_name": "Setup Fee",
    "units": "1.0",
    "apply_units_immediately": false,
    "properties": {
      "grouped_by": [
        "agent_name"
      ],
      "pricing_group_keys": [
        "agent_name"
      ],
      "graduated_ranges": [
        {
          "from_value": 0,
          "to_value": 10,
          "flat_amount": "10",
          "per_unit_amount": "0.5"
        }
      ],
      "graduated_percentage_ranges": [
        {
          "from_value": 0,
          "to_value": 10,
          "rate": "1",
          "flat_amount": "10"
        }
      ],
      "amount": "30",
      "free_units": 100,
      "package_size": 1000,
      "rate": "1",
      "fixed_amount": "0.5",
      "free_units_per_events": 5,
      "free_units_per_total_aggregation": "500",
      "per_transaction_max_amount": "3.75",
      "per_transaction_min_amount": "1.75",
      "volume_ranges": [
        {
          "from_value": 0,
          "to_value": 10,
          "flat_amount": "10",
          "per_unit_amount": "0.5"
        }
      ]
    },
    "tax_codes": [
      "french_standard_vat"
    ]
  }
}
'
import requests

url = "https://api.getlago.com/api/v1/subscriptions/{external_id}/fixed_charges/{fixed_charge_code}"

payload = { "fixed_charge": {
"invoice_display_name": "Setup Fee",
"units": "1.0",
"apply_units_immediately": False,
"properties": {
"grouped_by": ["agent_name"],
"pricing_group_keys": ["agent_name"],
"graduated_ranges": [
{
"from_value": 0,
"to_value": 10,
"flat_amount": "10",
"per_unit_amount": "0.5"
}
],
"graduated_percentage_ranges": [
{
"from_value": 0,
"to_value": 10,
"rate": "1",
"flat_amount": "10"
}
],
"amount": "30",
"free_units": 100,
"package_size": 1000,
"rate": "1",
"fixed_amount": "0.5",
"free_units_per_events": 5,
"free_units_per_total_aggregation": "500",
"per_transaction_max_amount": "3.75",
"per_transaction_min_amount": "1.75",
"volume_ranges": [
{
"from_value": 0,
"to_value": 10,
"flat_amount": "10",
"per_unit_amount": "0.5"
}
]
},
"tax_codes": ["french_standard_vat"]
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

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

print(response.text)
const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
fixed_charge: {
invoice_display_name: 'Setup Fee',
units: '1.0',
apply_units_immediately: false,
properties: {
grouped_by: ['agent_name'],
pricing_group_keys: ['agent_name'],
graduated_ranges: [{from_value: 0, to_value: 10, flat_amount: '10', per_unit_amount: '0.5'}],
graduated_percentage_ranges: [{from_value: 0, to_value: 10, rate: '1', flat_amount: '10'}],
amount: '30',
free_units: 100,
package_size: 1000,
rate: '1',
fixed_amount: '0.5',
free_units_per_events: 5,
free_units_per_total_aggregation: '500',
per_transaction_max_amount: '3.75',
per_transaction_min_amount: '1.75',
volume_ranges: [{from_value: 0, to_value: 10, flat_amount: '10', per_unit_amount: '0.5'}]
},
tax_codes: ['french_standard_vat']
}
})
};

fetch('https://api.getlago.com/api/v1/subscriptions/{external_id}/fixed_charges/{fixed_charge_code}', 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.getlago.com/api/v1/subscriptions/{external_id}/fixed_charges/{fixed_charge_code}",
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([
'fixed_charge' => [
'invoice_display_name' => 'Setup Fee',
'units' => '1.0',
'apply_units_immediately' => false,
'properties' => [
'grouped_by' => [
'agent_name'
],
'pricing_group_keys' => [
'agent_name'
],
'graduated_ranges' => [
[
'from_value' => 0,
'to_value' => 10,
'flat_amount' => '10',
'per_unit_amount' => '0.5'
]
],
'graduated_percentage_ranges' => [
[
'from_value' => 0,
'to_value' => 10,
'rate' => '1',
'flat_amount' => '10'
]
],
'amount' => '30',
'free_units' => 100,
'package_size' => 1000,
'rate' => '1',
'fixed_amount' => '0.5',
'free_units_per_events' => 5,
'free_units_per_total_aggregation' => '500',
'per_transaction_max_amount' => '3.75',
'per_transaction_min_amount' => '1.75',
'volume_ranges' => [
[
'from_value' => 0,
'to_value' => 10,
'flat_amount' => '10',
'per_unit_amount' => '0.5'
]
]
],
'tax_codes' => [
'french_standard_vat'
]
]
]),
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.getlago.com/api/v1/subscriptions/{external_id}/fixed_charges/{fixed_charge_code}"

payload := strings.NewReader("{\n \"fixed_charge\": {\n \"invoice_display_name\": \"Setup Fee\",\n \"units\": \"1.0\",\n \"apply_units_immediately\": false,\n \"properties\": {\n \"grouped_by\": [\n \"agent_name\"\n ],\n \"pricing_group_keys\": [\n \"agent_name\"\n ],\n \"graduated_ranges\": [\n {\n \"from_value\": 0,\n \"to_value\": 10,\n \"flat_amount\": \"10\",\n \"per_unit_amount\": \"0.5\"\n }\n ],\n \"graduated_percentage_ranges\": [\n {\n \"from_value\": 0,\n \"to_value\": 10,\n \"rate\": \"1\",\n \"flat_amount\": \"10\"\n }\n ],\n \"amount\": \"30\",\n \"free_units\": 100,\n \"package_size\": 1000,\n \"rate\": \"1\",\n \"fixed_amount\": \"0.5\",\n \"free_units_per_events\": 5,\n \"free_units_per_total_aggregation\": \"500\",\n \"per_transaction_max_amount\": \"3.75\",\n \"per_transaction_min_amount\": \"1.75\",\n \"volume_ranges\": [\n {\n \"from_value\": 0,\n \"to_value\": 10,\n \"flat_amount\": \"10\",\n \"per_unit_amount\": \"0.5\"\n }\n ]\n },\n \"tax_codes\": [\n \"french_standard_vat\"\n ]\n }\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.getlago.com/api/v1/subscriptions/{external_id}/fixed_charges/{fixed_charge_code}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"fixed_charge\": {\n \"invoice_display_name\": \"Setup Fee\",\n \"units\": \"1.0\",\n \"apply_units_immediately\": false,\n \"properties\": {\n \"grouped_by\": [\n \"agent_name\"\n ],\n \"pricing_group_keys\": [\n \"agent_name\"\n ],\n \"graduated_ranges\": [\n {\n \"from_value\": 0,\n \"to_value\": 10,\n \"flat_amount\": \"10\",\n \"per_unit_amount\": \"0.5\"\n }\n ],\n \"graduated_percentage_ranges\": [\n {\n \"from_value\": 0,\n \"to_value\": 10,\n \"rate\": \"1\",\n \"flat_amount\": \"10\"\n }\n ],\n \"amount\": \"30\",\n \"free_units\": 100,\n \"package_size\": 1000,\n \"rate\": \"1\",\n \"fixed_amount\": \"0.5\",\n \"free_units_per_events\": 5,\n \"free_units_per_total_aggregation\": \"500\",\n \"per_transaction_max_amount\": \"3.75\",\n \"per_transaction_min_amount\": \"1.75\",\n \"volume_ranges\": [\n {\n \"from_value\": 0,\n \"to_value\": 10,\n \"flat_amount\": \"10\",\n \"per_unit_amount\": \"0.5\"\n }\n ]\n },\n \"tax_codes\": [\n \"french_standard_vat\"\n ]\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.getlago.com/api/v1/subscriptions/{external_id}/fixed_charges/{fixed_charge_code}")

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 \"fixed_charge\": {\n \"invoice_display_name\": \"Setup Fee\",\n \"units\": \"1.0\",\n \"apply_units_immediately\": false,\n \"properties\": {\n \"grouped_by\": [\n \"agent_name\"\n ],\n \"pricing_group_keys\": [\n \"agent_name\"\n ],\n \"graduated_ranges\": [\n {\n \"from_value\": 0,\n \"to_value\": 10,\n \"flat_amount\": \"10\",\n \"per_unit_amount\": \"0.5\"\n }\n ],\n \"graduated_percentage_ranges\": [\n {\n \"from_value\": 0,\n \"to_value\": 10,\n \"rate\": \"1\",\n \"flat_amount\": \"10\"\n }\n ],\n \"amount\": \"30\",\n \"free_units\": 100,\n \"package_size\": 1000,\n \"rate\": \"1\",\n \"fixed_amount\": \"0.5\",\n \"free_units_per_events\": 5,\n \"free_units_per_total_aggregation\": \"500\",\n \"per_transaction_max_amount\": \"3.75\",\n \"per_transaction_min_amount\": \"1.75\",\n \"volume_ranges\": [\n {\n \"from_value\": 0,\n \"to_value\": 10,\n \"flat_amount\": \"10\",\n \"per_unit_amount\": \"0.5\"\n }\n ]\n },\n \"tax_codes\": [\n \"french_standard_vat\"\n ]\n }\n}"

response = http.request(request)
puts response.read_body
{
  "fixed_charge": {
    "lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
    "lago_add_on_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
    "invoice_display_name": "Setup fee",
    "add_on_code": "setup_fee",
    "created_at": "2023-06-27T19:43:42Z",
    "code": "setup_fee",
    "charge_model": "standard",
    "pay_in_advance": false,
    "prorated": false,
    "properties": {
      "amount": "30",
      "graduated_ranges": [
        {
          "from_value": 0,
          "to_value": 10,
          "flat_amount": "10",
          "per_unit_amount": "0.5"
        }
      ],
      "volume_ranges": [
        {
          "from_value": 0,
          "to_value": 10,
          "flat_amount": "10",
          "per_unit_amount": "0.5"
        }
      ]
    },
    "units": 1,
    "lago_parent_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
    "taxes": [
      {
        "lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
        "name": "TVA",
        "code": "french_standard_vat",
        "rate": 20,
        "applied_to_organization": true,
        "created_at": "2023-07-06T14:35:58Z",
        "description": "French standard VAT"
      }
    ]
  }
}
{
"status": 400,
"error": "Bad request"
}
{
"status": 401,
"error": "Unauthorized"
}
{
"status": 403,
"error": "Forbidden",
"code": "feature_unavailable"
}
{
"status": 404,
"error": "Not Found",
"code": "object_not_found"
}
{
"status": 422,
"error": "Unprocessable entity",
"code": "validation_errors",
"error_details": {}
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

external_id
string
required

External ID of the existing subscription.

Example:

"sub_1234567890"

fixed_charge_code
string
required

Code of the existing fixed charge.

Example:

"setup_fee_charge"

Query Parameters

subscription_status
enum<string>
default:active

Filter by subscription status. When provided, the subscription is looked up with this status instead of the default active status. Possible values are pending, active, terminated, or canceled.

Available options:
pending,
active,
terminated,
canceled
Example:

"active"

Body

application/json

Fixed charge override payload

fixed_charge
object
required

Properties of a fixed charge that can be overridden at the subscription level.

Response

Fixed charge override created or updated

fixed_charge
object
required