curl --request POST \
--url https://api.uselotus.io/api/subscriptions/update/ \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"replace_plan_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"invoicing_behavior": "invoice_now",
"usage_behavior": "transfer_to_new_subscription",
"turn_off_auto_renew": true,
"end_date": "2023-11-07T05:31:56Z"
}
'import requests
url = "https://api.uselotus.io/api/subscriptions/update/"
payload = {
"replace_plan_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"invoicing_behavior": "invoice_now",
"usage_behavior": "transfer_to_new_subscription",
"turn_off_auto_renew": True,
"end_date": "2023-11-07T05:31:56Z"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
replace_plan_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
invoicing_behavior: 'invoice_now',
usage_behavior: 'transfer_to_new_subscription',
turn_off_auto_renew: true,
end_date: '2023-11-07T05:31:56Z'
})
};
fetch('https://api.uselotus.io/api/subscriptions/update/', 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.uselotus.io/api/subscriptions/update/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'replace_plan_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'invoicing_behavior' => 'invoice_now',
'usage_behavior' => 'transfer_to_new_subscription',
'turn_off_auto_renew' => true,
'end_date' => '2023-11-07T05:31:56Z'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.uselotus.io/api/subscriptions/update/"
payload := strings.NewReader("{\n \"replace_plan_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"invoicing_behavior\": \"invoice_now\",\n \"usage_behavior\": \"transfer_to_new_subscription\",\n \"turn_off_auto_renew\": true,\n \"end_date\": \"2023-11-07T05:31:56Z\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.post("https://api.uselotus.io/api/subscriptions/update/")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"replace_plan_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"invoicing_behavior\": \"invoice_now\",\n \"usage_behavior\": \"transfer_to_new_subscription\",\n \"turn_off_auto_renew\": true,\n \"end_date\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.uselotus.io/api/subscriptions/update/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"replace_plan_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"invoicing_behavior\": \"invoice_now\",\n \"usage_behavior\": \"transfer_to_new_subscription\",\n \"turn_off_auto_renew\": true,\n \"end_date\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body[
{
"subscription_id": "<string>",
"start_date": "2023-11-07T05:31:56Z",
"end_date": "2023-11-07T05:31:56Z",
"auto_renew": true,
"is_new": true,
"subscription_filters": [
{
"value": "<string>",
"property_name": "<string>"
}
],
"customer": {
"customer_name": "<string>",
"email": "jsmith@example.com",
"customer_id": "<string>"
},
"billing_plan": {
"plan_name": "<string>",
"plan_id": "<string>",
"version_id": "<string>",
"version": 123
},
"fully_billed": true,
"addons": [
{
"addon_subscription_id": "<string>",
"start_date": "2023-11-07T05:31:56Z",
"end_date": "2023-11-07T05:31:56Z",
"addon": {
"addon_name": "<string>",
"addon_id": "<string>",
"addon_type": "flat",
"billing_frequency": "one_time"
},
"fully_billed": true
}
],
"metadata": {}
}
]Update a subscription
Upgrade, downgrade or cancel autorenew for a subscription plan
curl --request POST \
--url https://api.uselotus.io/api/subscriptions/update/ \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"replace_plan_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"invoicing_behavior": "invoice_now",
"usage_behavior": "transfer_to_new_subscription",
"turn_off_auto_renew": true,
"end_date": "2023-11-07T05:31:56Z"
}
'import requests
url = "https://api.uselotus.io/api/subscriptions/update/"
payload = {
"replace_plan_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"invoicing_behavior": "invoice_now",
"usage_behavior": "transfer_to_new_subscription",
"turn_off_auto_renew": True,
"end_date": "2023-11-07T05:31:56Z"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
replace_plan_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
invoicing_behavior: 'invoice_now',
usage_behavior: 'transfer_to_new_subscription',
turn_off_auto_renew: true,
end_date: '2023-11-07T05:31:56Z'
})
};
fetch('https://api.uselotus.io/api/subscriptions/update/', 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.uselotus.io/api/subscriptions/update/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'replace_plan_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'invoicing_behavior' => 'invoice_now',
'usage_behavior' => 'transfer_to_new_subscription',
'turn_off_auto_renew' => true,
'end_date' => '2023-11-07T05:31:56Z'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.uselotus.io/api/subscriptions/update/"
payload := strings.NewReader("{\n \"replace_plan_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"invoicing_behavior\": \"invoice_now\",\n \"usage_behavior\": \"transfer_to_new_subscription\",\n \"turn_off_auto_renew\": true,\n \"end_date\": \"2023-11-07T05:31:56Z\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.post("https://api.uselotus.io/api/subscriptions/update/")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"replace_plan_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"invoicing_behavior\": \"invoice_now\",\n \"usage_behavior\": \"transfer_to_new_subscription\",\n \"turn_off_auto_renew\": true,\n \"end_date\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.uselotus.io/api/subscriptions/update/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"replace_plan_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"invoicing_behavior\": \"invoice_now\",\n \"usage_behavior\": \"transfer_to_new_subscription\",\n \"turn_off_auto_renew\": true,\n \"end_date\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body[
{
"subscription_id": "<string>",
"start_date": "2023-11-07T05:31:56Z",
"end_date": "2023-11-07T05:31:56Z",
"auto_renew": true,
"is_new": true,
"subscription_filters": [
{
"value": "<string>",
"property_name": "<string>"
}
],
"customer": {
"customer_name": "<string>",
"email": "jsmith@example.com",
"customer_id": "<string>"
},
"billing_plan": {
"plan_name": "<string>",
"plan_id": "<string>",
"version_id": "<string>",
"version": 123
},
"fully_billed": true,
"addons": [
{
"addon_subscription_id": "<string>",
"start_date": "2023-11-07T05:31:56Z",
"end_date": "2023-11-07T05:31:56Z",
"addon": {
"addon_name": "<string>",
"addon_id": "<string>",
"addon_type": "flat",
"billing_frequency": "one_time"
},
"fully_billed": true
}
],
"metadata": {}
}
]lotus.update_subscription(
customer_id='cust_0569173ee6654369',
plan_id="plan_123",
replace_plan_id="plan_456",
invocing_behavior="add_to_next_invoice",
turn_off_auto_renew=True
)
lotus.update_subscription(
customer_id='cust_0569173ee6654369',
plan_id="plan_123",
subscription_filters=[{"property_name": "status", "value": "active"}],
end_date=datetime.date(2022, 12, 8),
)
await lotus.updateSubscription({
customerId: "cust_234";
planId: "plan_234";
subscriptionFilters: [{property_name: "project_id", value: "3234123"}];
replacePlanId: "plan_235";
invoicingBehavior: "add_to_next_invoice";
usageBehavior: "transfer_to_new_subscription"
});
Authorizations
Token-based authentication with required prefix "Token"
Query Parameters
Filter to a specific customer.
1Filter to a specific plan.
Filter to a specific set of subscription filters. If your billing model only allows for one subscription per customer, you very likely do not need this field. Must be formatted as a JSON-encoded + stringified list of dictionaries, where each dictionary has a key of 'property_name' and a key of 'value'.
Show child attributes
Show child attributes
Body
[DEPRECATED] Will currently perform a best-effort attempt to find the correct plan version to replace the current plan with. If more than one plan version matches the criteria, this will return an error. Use the change_plan method of a subscription instance instead.
The invoicing behavior to use when replacing the plan. Invoice now will invoice the customer for the prorated difference of the old plan and the new plan, whereas add_to_next_invoice will wait until the end of the subscription to do the calculation.
add_to_next_invoice- Add to Next Invoiceinvoice_now- Invoice Now
add_to_next_invoice, invoice_now The usage behavior to use when replacing the plan. Transfer to new subscription will transfer the usage from the old subscription to the new subscription, whereas keep_separate will reset the usage to 0 for the new subscription, while keeping the old usage on the old subscription and charging for that appropriately at the end of the month.
transfer_to_new_subscription- Transfer to New Subscriptionkeep_separate- Keep Separate
transfer_to_new_subscription, keep_separate Turn off auto renew for the subscription
Change the end date for the subscription.
Response
The time the subscription starts. This will be a string in yyyy-mm-dd HH:mm:ss format in UTC time.
The time the subscription starts. This will be a string in yyyy-mm-dd HH:mm:ss format in UTC time.
Whether the subscription automatically renews. Defaults to true.
Whether this subscription came from a renewal or from a first-time. Defaults to true on creation.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes