Skip to main content

getAllSubscriptions

Get all available subscriptions. 🔐 This method requires authorization.

Description

This method returns all subscription plans available in the project. It returns a Promise that resolves to an array of ISubscriptionEntity objects - full subscription objects, not markers.

⚠️ In earlier SDK versions this method was declared as returning string[]. The signature came from swagger, while the endpoint has always returned full objects. If you were reading markers from the array elements, switch to their identifier field:

const subscriptions = await Subscriptions.getAllSubscriptions();

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

getActiveSubscriptions is unchanged and still returns string[].

Subscriptions.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 identifier.
example: 1

identifier: string
Subscription textual identifier (marker).
example: "test_subscription"

localizeInfos: ILocalizeInfo
Localized subscription info for the current language.
example:

{ title: "Test subscription" }

productIds: number[]
Identifiers 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
Indicates whether the subscription is in use.
example: false