curl --request POST \
--url https://coreapi.io/api/customer/subscriptions/{id}/plan-tier-preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"planTierId": "f5ece259-08ea-77a4-8bd9-9f3a9ed9e246",
"items": []
}
'import requests
url = "https://coreapi.io/api/customer/subscriptions/{id}/plan-tier-preview"
payload = {
"planTierId": "f5ece259-08ea-77a4-8bd9-9f3a9ed9e246",
"items": []
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({planTierId: 'f5ece259-08ea-77a4-8bd9-9f3a9ed9e246', items: []})
};
fetch('https://coreapi.io/api/customer/subscriptions/{id}/plan-tier-preview', 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://coreapi.io/api/customer/subscriptions/{id}/plan-tier-preview",
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([
'planTierId' => 'f5ece259-08ea-77a4-8bd9-9f3a9ed9e246',
'items' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"creditAmount": "14.50",
"chargeAmount": "24.50",
"currency": "EUR",
"effectiveAt": "2023-11-07T05:31:56Z",
"recurringTotal": {
"netAmount": "49.00",
"taxAmount": "9.31",
"grossAmount": "58.31",
"currency": "EUR"
},
"warnings": [
"active_discount_will_be_lost"
]
}{
"status": 404,
"type": "PLAN__NOT_FOUND",
"title": "An error occurred",
"detail": "Plan not found."
}{
"status": 404,
"type": "PLAN__NOT_FOUND",
"title": "An error occurred",
"detail": "Plan not found."
}{
"status": 404,
"type": "PLAN__NOT_FOUND",
"title": "An error occurred",
"detail": "Plan not found."
}{
"status": 422,
"type": "https://tools.ietf.org/html/rfc2616#section-10",
"title": "Validation Failed",
"violations": [
{
"propertyPath": "tiers[0].name",
"message": "This value should not be blank.",
"code": "<string>"
}
]
}Preview a tier switch
Return a financial preview for switching the subscription into a target tier, with optional quantity overrides. This call does not change anything.
curl --request POST \
--url https://coreapi.io/api/customer/subscriptions/{id}/plan-tier-preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"planTierId": "f5ece259-08ea-77a4-8bd9-9f3a9ed9e246",
"items": []
}
'import requests
url = "https://coreapi.io/api/customer/subscriptions/{id}/plan-tier-preview"
payload = {
"planTierId": "f5ece259-08ea-77a4-8bd9-9f3a9ed9e246",
"items": []
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({planTierId: 'f5ece259-08ea-77a4-8bd9-9f3a9ed9e246', items: []})
};
fetch('https://coreapi.io/api/customer/subscriptions/{id}/plan-tier-preview', 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://coreapi.io/api/customer/subscriptions/{id}/plan-tier-preview",
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([
'planTierId' => 'f5ece259-08ea-77a4-8bd9-9f3a9ed9e246',
'items' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"creditAmount": "14.50",
"chargeAmount": "24.50",
"currency": "EUR",
"effectiveAt": "2023-11-07T05:31:56Z",
"recurringTotal": {
"netAmount": "49.00",
"taxAmount": "9.31",
"grossAmount": "58.31",
"currency": "EUR"
},
"warnings": [
"active_discount_will_be_lost"
]
}{
"status": 404,
"type": "PLAN__NOT_FOUND",
"title": "An error occurred",
"detail": "Plan not found."
}{
"status": 404,
"type": "PLAN__NOT_FOUND",
"title": "An error occurred",
"detail": "Plan not found."
}{
"status": 404,
"type": "PLAN__NOT_FOUND",
"title": "An error occurred",
"detail": "Plan not found."
}{
"status": 422,
"type": "https://tools.ietf.org/html/rfc2616#section-10",
"title": "Validation Failed",
"violations": [
{
"propertyPath": "tiers[0].name",
"message": "This value should not be blank.",
"code": "<string>"
}
]
}Autorisierungen
Customer access token. Send it as Authorization: Bearer . Obtain it server side via POST /customers/{id}/authenticate (use the response accessToken), or from a customer portal session. The token must carry the customer:plan:switch permission.
Pfadparameter
The subscription UUID.
"1280792f-4e23-793d-8e9c-3a1bf36630bd"
Body
Antwort
The switch preview. May be null when no schedule exists yet.
Financial preview of a tier switch. creditAmount and chargeAmount are absolute decimal strings, the direction is implied by the field name.
Credit for unused time on the current items. 0.00 when the target tier does not credit.
"14.50"
Charge for the partial period on the new items.
"24.50"
"EUR"
Date the switch is calculated for. For end_of_period tiers the preview uses the current moment, so the amounts are an approximation.
Recurring amount for one billing period. Amounts are decimal strings.
Show child attributes
Show child attributes
Hints about side effects, for example that an active discount will not carry over.
["active_discount_will_be_lost"]
War diese Seite hilfreich?