Calculate buyout price
curl --request POST \
--url https://api-eu.flexportal.io/v1/subscriptions/calculate-buyout \
--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-buyout"
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-buyout', 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-buyout",
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-buyout"
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-buyout")
.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-buyout")
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,
"buyoutPrice": 123,
"remainingPayments": 123,
"depreciatedValue": 123
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Subscriptions
Calculate Buyout Price
Calculates the buyout price for a subscription without performing the buyout.
POST
/
v1
/
subscriptions
/
calculate-buyout
Calculate buyout price
curl --request POST \
--url https://api-eu.flexportal.io/v1/subscriptions/calculate-buyout \
--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-buyout"
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-buyout', 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-buyout",
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-buyout"
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-buyout")
.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-buyout")
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,
"buyoutPrice": 123,
"remainingPayments": 123,
"depreciatedValue": 123
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Overview
Calculate the buyout price for a subscription before processing the actual buyout. This endpoint returns a recommended price based on remaining contract value and configured residual rates—use it to present buyout options to customers.This is a read-only calculation—it doesn’t modify the subscription. Call Buyout Subscription to actually process the buyout.
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": {
"buyoutPrice": 658.00,
"breakdown": {
"remainingContractValue": 516.00,
"residualValue": 142.00,
"monthsRemaining": 4,
"monthlyAmount": 129.00
},
"costRecovery": {
"acquisitionCost": 1800.00,
"totalCollected": 1548.00,
"projectedAfterBuyout": 2206.00,
"projectedMargin": 406.00,
"marginPercent": 22.6
}
}
}
Understanding the Calculation
Remaining Contract Value
The value of remaining payments:remainingContractValue = monthsRemaining × monthlyAmount
Residual Value
The minimum asset value at contract end, typically:- A percentage of acquisition cost (e.g., 5-15%)
- Or a fixed minimum amount
- Configured in tenant settings
Buyout Price
buyoutPrice = remainingContractValue + residualValue
Common Use Cases
1. Quoting Customers
async function getBuyoutQuote(subscriptionId) {
const calc = await calculateBuyout({ subscriptionId });
return {
price: calc.calculation.buyoutPrice,
monthsLeft: calc.calculation.breakdown.monthsRemaining,
savedMonths: calc.calculation.breakdown.monthsRemaining,
message: `Buy now for €${calc.calculation.buyoutPrice} (saves ${calc.calculation.breakdown.monthsRemaining} months of payments)`
};
}
2. Evaluating Profitability
async function shouldOfferBuyout(subscriptionId) {
const calc = await calculateBuyout({ subscriptionId });
const marginPercent = calc.calculation.costRecovery.marginPercent;
return {
recommend: marginPercent > 15, // Only offer if > 15% margin
margin: marginPercent,
buyoutPrice: calc.calculation.buyoutPrice
};
}
3. Bulk Analysis
async function analyzeBuyoutOpportunities() {
// Get subscriptions ending in next 3 months
const { subscriptions } = await listSubscriptions({
status: 'active',
endDateTo: threeMonthsFromNow
});
const opportunities = [];
for (const sub of subscriptions) {
const calc = await calculateBuyout({ subscriptionId: sub.subscriptionId });
if (calc.calculation.costRecovery.marginPercent > 20) {
opportunities.push({
subscriptionId: sub.subscriptionId,
customer: sub.customerId,
product: sub.productName,
buyoutPrice: calc.calculation.buyoutPrice,
margin: calc.calculation.costRecovery.marginPercent
});
}
}
return opportunities;
}
Presentation Tips
When showing buyout prices to customers:- Highlight savings: Show total remaining payments vs buyout price
- Ownership benefits: Emphasize they keep the device forever
- No more payments: Monthly billing stops after buyout
- Immediate: They can own it today
Related Endpoints
- Buyout Subscription - Process the actual buyout
- Get Subscription - Get subscription details
- Calculate Early Return - Alternative: early return fee
Authorizations
API key obtained from FlexPortal dashboard
Headers
Your tenant identifier
Body
application/json
The subscription ID
Was this page helpful?