You can retrieve subscriptions like entries and products as they are also elements within Craft.
You can access your site’s subscriptions from your templates via craft.subscriptions
It returns an ElementQuery object.
{% set subscription = craft.subscriptions.reference('sub_CTnhYZOTr4zkwW').one() %}
{% if subscription %}
{{ subscription.plan.name }} - {{ subscription.status }} - {{ subscription.nextPaymentDate|date }}
{% endif %}
craft.subscriptions
supports the following parameters:
The subscription's element ID.
Accepts: Integer
The date the subscription was cancelled.
Accepts: Date|string
The date the subscription was cancelled.
Accepts: Date|string
The gateway ID this subscription belongs to.
Accepts: Integer
Whether the subscription status is cancelled
Accepts: boolean (true
or false
)
Whether the subscription status is expires
Accepts: boolean (true
or false
)
The date of the next payment due for this subscription
Accepts: Date
Whether the subscription is currently on trial.
Accepts: boolean (true
or false
)
The plan the subscription beloings to.
Accepts: Plan
The ID of the plan the subscription beloings to.
Accepts: Integer
The reference for this subscription within the gateway's 3rd party system.
Accepts: string
Get subscriptions subscribed after this date
Accepts: Date
Get subscriptions subscribed before this date
Accepts: Date
Get subscriptions by the number of trial days given
Accepts: Integer
The user the subscription belongs to
Accepts: User
The user ID the subscription belongs to
Accepts: Integer