curl --request POST \
--url https://api.uselotus.io/api/subscriptions/{subscription_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}/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}/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}/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}/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}/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}/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{
"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": {}
}Cancel a subscription
Cancels a subscription. You can modify the behavior of the cancellation based on the arguments passed to the call.
curl --request POST \
--url https://api.uselotus.io/api/subscriptions/{subscription_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}/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}/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}/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}/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}/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}/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{
"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.cancel_subscription(
subscription_id='sub_a623349004cd4947aca1851c64aa6fbd',
flat_fee_behavior='charge_prorated',
usage_behavior='bill_full',
invoicing_behavior='invoice_now'
)
await lotus.cancelSubscription({
subscription_id: "sub_a623349004cd4947aca1851c64aa6fbd",
flat_fee_behavior: "charge_prorated",
usage_behavior: "bill_full",
invoicing_behavior: "invoice_now",
});
Authorizations
Token-based authentication with required prefix "Token"
Path Parameters
The ID of the subscription to cancel.
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
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