curl --request POST \
--url https://api.uselotus.io/api/subscriptions/{subscription_id}/addons/{addon_id}/cancel/ \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"usage_behavior": "bill_full",
"invoicing_behavior": "invoice_now"
}
'import requests
url = "https://api.uselotus.io/api/subscriptions/{subscription_id}/addons/{addon_id}/cancel/"
payload = {
"usage_behavior": "bill_full",
"invoicing_behavior": "invoice_now"
}
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({usage_behavior: 'bill_full', invoicing_behavior: 'invoice_now'})
};
fetch('https://api.uselotus.io/api/subscriptions/{subscription_id}/addons/{addon_id}/cancel/', 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/{subscription_id}/addons/{addon_id}/cancel/",
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([
'usage_behavior' => 'bill_full',
'invoicing_behavior' => 'invoice_now'
]),
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/{subscription_id}/addons/{addon_id}/cancel/"
payload := strings.NewReader("{\n \"usage_behavior\": \"bill_full\",\n \"invoicing_behavior\": \"invoice_now\"\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/{subscription_id}/addons/{addon_id}/cancel/")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"usage_behavior\": \"bill_full\",\n \"invoicing_behavior\": \"invoice_now\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.uselotus.io/api/subscriptions/{subscription_id}/addons/{addon_id}/cancel/")
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 \"usage_behavior\": \"bill_full\",\n \"invoicing_behavior\": \"invoice_now\"\n}"
response = http.request(request)
puts response.read_body[
{
"addon_subscription_id": "<string>",
"customer": {
"customer_name": "<string>",
"email": "jsmith@example.com",
"customer_id": "<string>"
},
"addon": {
"addon_name": "<string>",
"addon_id": "<string>",
"addon_type": "flat",
"billing_frequency": "one_time"
},
"start_date": "2023-11-07T05:31:56Z",
"end_date": "2023-11-07T05:31:56Z",
"parent": {
"fully_billed": true,
"plan_detail": {
"plan_name": "<string>",
"plan_id": "<string>",
"version_id": "<string>",
"version": 123
},
"subscription_id": "<string>",
"metadata": {},
"subscription_filters": [
{
"value": "<string>",
"property_name": "<string>"
}
],
"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
}
],
"is_new": true,
"customer": {
"customer_name": "<string>",
"email": "jsmith@example.com",
"customer_id": "<string>"
},
"billing_plan": {
"plan_name": "<string>",
"plan_id": "<string>",
"version_id": "<string>",
"version": 123
},
"start_date": "2023-11-07T05:31:56Z",
"end_date": "2023-11-07T05:31:56Z",
"auto_renew": true
},
"fully_billed": true,
"auto_renew": true,
"metadata": {}
}
]Cancel an Add-On
Cancel an addon in the customer’s subscription
curl --request POST \
--url https://api.uselotus.io/api/subscriptions/{subscription_id}/addons/{addon_id}/cancel/ \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"usage_behavior": "bill_full",
"invoicing_behavior": "invoice_now"
}
'import requests
url = "https://api.uselotus.io/api/subscriptions/{subscription_id}/addons/{addon_id}/cancel/"
payload = {
"usage_behavior": "bill_full",
"invoicing_behavior": "invoice_now"
}
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({usage_behavior: 'bill_full', invoicing_behavior: 'invoice_now'})
};
fetch('https://api.uselotus.io/api/subscriptions/{subscription_id}/addons/{addon_id}/cancel/', 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/{subscription_id}/addons/{addon_id}/cancel/",
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([
'usage_behavior' => 'bill_full',
'invoicing_behavior' => 'invoice_now'
]),
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/{subscription_id}/addons/{addon_id}/cancel/"
payload := strings.NewReader("{\n \"usage_behavior\": \"bill_full\",\n \"invoicing_behavior\": \"invoice_now\"\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/{subscription_id}/addons/{addon_id}/cancel/")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"usage_behavior\": \"bill_full\",\n \"invoicing_behavior\": \"invoice_now\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.uselotus.io/api/subscriptions/{subscription_id}/addons/{addon_id}/cancel/")
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 \"usage_behavior\": \"bill_full\",\n \"invoicing_behavior\": \"invoice_now\"\n}"
response = http.request(request)
puts response.read_body[
{
"addon_subscription_id": "<string>",
"customer": {
"customer_name": "<string>",
"email": "jsmith@example.com",
"customer_id": "<string>"
},
"addon": {
"addon_name": "<string>",
"addon_id": "<string>",
"addon_type": "flat",
"billing_frequency": "one_time"
},
"start_date": "2023-11-07T05:31:56Z",
"end_date": "2023-11-07T05:31:56Z",
"parent": {
"fully_billed": true,
"plan_detail": {
"plan_name": "<string>",
"plan_id": "<string>",
"version_id": "<string>",
"version": 123
},
"subscription_id": "<string>",
"metadata": {},
"subscription_filters": [
{
"value": "<string>",
"property_name": "<string>"
}
],
"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
}
],
"is_new": true,
"customer": {
"customer_name": "<string>",
"email": "jsmith@example.com",
"customer_id": "<string>"
},
"billing_plan": {
"plan_name": "<string>",
"plan_id": "<string>",
"version_id": "<string>",
"version": 123
},
"start_date": "2023-11-07T05:31:56Z",
"end_date": "2023-11-07T05:31:56Z",
"auto_renew": true
},
"fully_billed": true,
"auto_renew": true,
"metadata": {}
}
]lotus.cancel_addon(
subscription_id='sub_e953bfbf42a442ca90079c8f1656d306',
addon_id='addon_5af61a194ca144478fb2721dd34c9049',
flat_fee_behavior='charge_prorated',
invoicing_behavior='invoice_now'
)
await lotus.cancelAddon({
subscription_id: "sub_e953bfbf42a442ca90079c8f1656d306",
addon_id: "addon_5af61a194ca144478fb2721dd34c9049",
flat_fee_behavior: "charge_prorated",
invoicing_behavior: "invoice_now",
});
Authorizations
Token-based authentication with required prefix "Token"
Path Parameters
The ID of the addon within the subscription update.
The ID of the subscription to update.
Body
When canceling a subscription, the behavior used to calculate the flat fee. If null or not provided, the charge's default behavior will be used according to the subscription's start and end dates. If charge_full, the full flat fee will be charged, regardless of the duration of the subscription. If refund, the flat fee will not be charged. If charge_prorated, the prorated flat fee will be charged.
refund- Refundcharge_prorated- Proratecharge_full- Charge Full
refund, charge_prorated, charge_full, null If bill_full, current usage will be billed on the invoice. If bill_none, current unbilled usage will be dropped from the invoice. Defaults to bill_full.
bill_full- Bill Fullbill_none- Bill None
bill_full, bill_none Whether to invoice now or invoice at the end of the billing period. Defaults to invoice now.
add_to_next_invoice- Add to Next Invoiceinvoice_now- Invoice Now
add_to_next_invoice, invoice_now Response
Show child attributes
Show child attributes
Show child attributes
Show child attributes
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.
Show child attributes
Show child attributes
Whether the subscription automatically renews. Defaults to true.
Show child attributes
Show child attributes