Calculate early return fee
curl --request POST \
--url https://api-eu.flexportal.io/v1/subscriptions/calculate-early-return-fee \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Tenant-ID: <tenant-id>' \
--data '
{
"rentalId": "<string>"
}
'import requests
url = "https://api-eu.flexportal.io/v1/subscriptions/calculate-early-return-fee"
payload = { "rentalId": "<string>" }
headers = {
"Tenant-ID": "<tenant-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Tenant-ID': '<tenant-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({rentalId: '<string>'})
};
fetch('https://api-eu.flexportal.io/v1/subscriptions/calculate-early-return-fee', 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-eu.flexportal.io/v1/subscriptions/calculate-early-return-fee",
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([
'rentalId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Tenant-ID: <tenant-id>"
],
]);
$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-eu.flexportal.io/v1/subscriptions/calculate-early-return-fee"
payload := strings.NewReader("{\n \"rentalId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Tenant-ID", "<tenant-id>")
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.post("https://api-eu.flexportal.io/v1/subscriptions/calculate-early-return-fee")
.header("Tenant-ID", "<tenant-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"rentalId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-eu.flexportal.io/v1/subscriptions/calculate-early-return-fee")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Tenant-ID"] = '<tenant-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"rentalId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"earlyReturnFee": 123,
"remainingMonths": 123,
"penaltyPercentage": 123
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Subscriptions
Calculate Early Return Fee
Calculates the early return fee for a subscription without performing the return.
POST
/
v1
/
subscriptions
/
calculate-early-return-fee
Calculate early return fee
curl --request POST \
--url https://api-eu.flexportal.io/v1/subscriptions/calculate-early-return-fee \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Tenant-ID: <tenant-id>' \
--data '
{
"rentalId": "<string>"
}
'import requests
url = "https://api-eu.flexportal.io/v1/subscriptions/calculate-early-return-fee"
payload = { "rentalId": "<string>" }
headers = {
"Tenant-ID": "<tenant-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Tenant-ID': '<tenant-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({rentalId: '<string>'})
};
fetch('https://api-eu.flexportal.io/v1/subscriptions/calculate-early-return-fee', 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-eu.flexportal.io/v1/subscriptions/calculate-early-return-fee",
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([
'rentalId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Tenant-ID: <tenant-id>"
],
]);
$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-eu.flexportal.io/v1/subscriptions/calculate-early-return-fee"
payload := strings.NewReader("{\n \"rentalId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Tenant-ID", "<tenant-id>")
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.post("https://api-eu.flexportal.io/v1/subscriptions/calculate-early-return-fee")
.header("Tenant-ID", "<tenant-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"rentalId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-eu.flexportal.io/v1/subscriptions/calculate-early-return-fee")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Tenant-ID"] = '<tenant-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"rentalId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"earlyReturnFee": 123,
"remainingMonths": 123,
"penaltyPercentage": 123
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Overview
Calculate the early return fee for a subscription before processing the actual early return. This endpoint returns a recommended fee based on remaining contract value and your configured policies—use it to present options to customers.This is a read-only calculation—it doesn’t modify the subscription. Call Early Return to actually process the return.
Request Fields
| Field | Required | Description |
|---|---|---|
subscriptionId | Yes | The subscription to calculate for |
Example Request
{
"subscriptionId": "sub_abc123"
}
Response Structure
{
"success": true,
"subscriptionId": "sub_abc123",
"calculation": {
"earlyReturnFee": 258.00,
"breakdown": {
"remainingContractValue": 516.00,
"feePercentage": 50,
"monthsRemaining": 4,
"monthlyAmount": 129.00
},
"costRecovery": {
"acquisitionCost": 1800.00,
"totalCollected": 1548.00,
"projectedWithFee": 1806.00,
"costRecoveryPercent": 100.3
}
}
}
Understanding the Calculation
Remaining Contract Value
Total value of remaining payments:remainingContractValue = monthsRemaining × monthlyAmount
Fee Percentage
The percentage of remaining value charged as fee (configured in tenant settings):earlyReturnFee = remainingContractValue × (feePercentage / 100)
Cost Recovery Impact
The calculation shows whether you’ll recover costs even with early return:projectedWithFee: Total collected + early return feecostRecoveryPercent: Whether acquisition cost is covered
Common Use Cases
1. Quoting Customers
async function getEarlyReturnQuote(subscriptionId) {
const calc = await calculateEarlyReturnFee({ subscriptionId });
return {
fee: calc.calculation.earlyReturnFee,
monthsLeft: calc.calculation.breakdown.monthsRemaining,
regularPayments: calc.calculation.breakdown.remainingContractValue,
savings: calc.calculation.breakdown.remainingContractValue - calc.calculation.earlyReturnFee,
message: `Early return fee: €${calc.calculation.earlyReturnFee} (saves €${savings} vs completing contract)`
};
}
2. Comparing Options for Customer
async function getEndingOptions(subscriptionId) {
const [earlyReturn, buyout] = await Promise.all([
calculateEarlyReturnFee({ subscriptionId }),
calculateBuyout({ subscriptionId })
]);
return {
options: [
{
action: 'Complete contract',
cost: earlyReturn.calculation.breakdown.remainingContractValue,
outcome: 'Return device at contract end'
},
{
action: 'Early return now',
cost: earlyReturn.calculation.earlyReturnFee,
outcome: 'Return device today, pay fee'
},
{
action: 'Buyout',
cost: buyout.calculation.buyoutPrice,
outcome: 'Keep device forever'
}
]
};
}
3. Evaluating Fee Waiver
async function shouldWaiveFee(subscriptionId, customerHistory) {
const calc = await calculateEarlyReturnFee({ subscriptionId });
// Check if we've already recovered our costs
const costRecovered = calc.calculation.costRecovery.costRecoveryPercent >= 100;
// Check customer value
const isHighValueCustomer = customerHistory.lifetimeRevenue > 5000;
return {
fee: calc.calculation.earlyReturnFee,
recommendWaive: costRecovered && isHighValueCustomer,
reason: costRecovered
? 'Asset costs fully recovered'
: 'Consider partial waiver for customer retention'
};
}
Presentation Tips
When showing early return fees to customers:- Compare to remaining payments: Show savings vs completing contract
- Explain the policy: Help customers understand the fee rationale
- Offer alternatives: Present buyout or extension options
- Be flexible: Consider waivers for good customers or hardship cases
Related Endpoints
- Early Return - Process the actual early return
- Calculate Buyout - Alternative: buyout calculation
- Get Subscription - Get subscription details
- Extend Subscription - Alternative: extend contract
Authorizations
API key obtained from FlexPortal dashboard
Headers
Your tenant identifier
Body
application/json
The subscription ID
Was this page helpful?