Skip to main content

getAllSubscriptions

Get all available subscriptions. This method doesn't require user authorization.

Description​

Fetches the subscription plans available in the project. Resolves to an array of full ISubscriptionEntity objects, not markers.

Earlier SDK versions declared this method as returning string[], but the endpoint has always returned full objects. If your code reads markers from the array, use each element's identifier:

const subscriptions = await Subscriptions.getAllSubscriptions();

// before: subscriptions // string[]
// now: subscriptions.map((s) => s.identifier)

getActiveSubscriptions is unchanged and still returns string[].

.getAllSubscriptions(

);

Examples​

Minimal example​

const response = await Subscriptions.getAllSubscriptions();

Example response​

[
{
"id": 1,
"identifier": "test_subscription",
"localizeInfos": {
"title": "Test subscription"
},
"productIds": [
3445
],
"periodInDays": 30,
"paymentAccountId": 1,
"isUsed": false
}
]

Response schema​

Schema: ISubscriptionEntity[]

id: number
Subscription ID.
example: 1

identifier: string
Marker of the subscription.
example: "test_subscription"

localizeInfos: ILocalizeInfo
Localized data of the subscription in the current language.
example:

{ title: "Test subscription" }

productIds: number[]
IDs of the products included in the subscription.
example: [3445]

periodInDays: number
Subscription period in days.
example: 30

paymentAccountId: number
Identifier of the payment account the subscription is billed through.
example: 1

isUsed: boolean
Whether the subscription is in use.
example: false