Zum Hauptinhalt springen
GET
/
api
/
customer
/
subscriptions
/
{id}
/
plan-options
Get plan switch options
curl --request GET \
  --url https://coreapi.io/api/customer/subscriptions/{id}/plan-options \
  --header 'Authorization: Bearer <token>'
import requests

url = "https://coreapi.io/api/customer/subscriptions/{id}/plan-options"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://coreapi.io/api/customer/subscriptions/{id}/plan-options', 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-options",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
{
  "currentTier": {
    "id": "<string>",
    "planId": "<string>",
    "planCode": "pro-plan",
    "position": 123,
    "name": "Pro",
    "currency": "EUR",
    "items": [
      {
        "id": "<string>",
        "productId": "<string>",
        "productName": "Pro Plan",
        "defaultQuantity": 123,
        "minQuantity": 123,
        "maxQuantity": 123,
        "quantityEditable": true,
        "pricePlan": {}
      }
    ],
    "recurringTotal": {
      "netAmount": "49.00",
      "taxAmount": "9.31",
      "grossAmount": "58.31",
      "currency": "EUR"
    }
  },
  "options": [
    {
      "tier": {
        "id": "<string>",
        "planId": "<string>",
        "planCode": "pro-plan",
        "position": 123,
        "name": "Pro",
        "currency": "EUR",
        "items": [
          {
            "id": "<string>",
            "productId": "<string>",
            "productName": "Pro Plan",
            "defaultQuantity": 123,
            "minQuantity": 123,
            "maxQuantity": 123,
            "quantityEditable": true,
            "pricePlan": {}
          }
        ],
        "recurringTotal": {
          "netAmount": "49.00",
          "taxAmount": "9.31",
          "grossAmount": "58.31",
          "currency": "EUR"
        }
      },
      "preview": {
        "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

Authorization
string
header
erforderlich

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

id
string<uuid>
erforderlich

The subscription UUID.

Beispiel:

"1280792f-4e23-793d-8e9c-3a1bf36630bd"

Antwort

Current tier and reachable options.

currentTier
object
options
object[]

All tiers the subscription can reach from its current tier, each with a financial preview.