Subscription Model

The Charge_SubscriptionModel describes a recurring charge subscription.

When a new recurring charge is created, we silently create a subscription model under the hood. The subscription model holds the current details of a recurring plan, and is updated via web hook callback events.

This isn't the Membership Subscription The subscription model refers to the recurring payment on a charge only, not a membership subscription. A membership subscription can have a related subscription, but it might not.

You can use the Charge_SubscriptionModel to accurately get the current state of any recurring payment detail for any charge. This is especially useful for exposing details like the date of the next payment for a customer.

Because subscriptions change and have activity outside of the Craft site, we keep this updated via web hooks.

Make sure your web hooks are configured Charge keeps the subscription model up to date via web hook callback events. If you've not got your callbacks properly enabled, the subscription model details can fall out of step with the actual details.


Attributes

id Number
The id of the subscription.
chargeId Number
The id of the parent charge.
customerId Number
The id of the parent customer.
stripeId String
The stripe id of the payment subscription as it exists on Stripe.
mode String, live or test
The mode for this subscription.
active Bool
Is this subscription currently active? true if active.
status String
The status of the subscription. Possible values are trialing, active, past_due, canceled, or unpaid. A subscription still in its trial period is trialing and moves to active when the trial period is over. When payment to renew the subscription fails, the subscription becomes past_due. After Stripe has exhausted all payment retry attempts, the subscription ends up with a status of either canceled or unpaid depending on your retry settings.
cancelAtPeriodEnd Bool
A bool flag to indicate if the subscription will be cancelled at the end of the current period.
currentPeriodStart Number
A timestamp of the current period start time. Use twig date filters to format this.
currentPeriodEnd Number
A timestamp of the current period end time. Use twig date filters to format this.
endedAt Number, or null
The timestamp when the subscription ended, if the subscription has ended. null otherwise.
trialStart Number, or null
The timestamp of when the trial started, if there was one.
trialEnd Number, or null
The timestamp of when the trial ends, if there is one.
canceledAt Number, or null
The timestamp of when the subscription was canceled.
applicationFeePercent Number
The percentage of an applied application fee. Useful with the Stripe connect features.
planAmount Number
The amount for the subscription. ie. Returns '5' for a $5 subscription.
planName String
An optional plan name for the subscription, as supplied during creation.
planInterval String, day, week, month, year
The interval period for the subscription
planIntervalCount Number
The interval count for the subscription.
planTrialPeriodDays Number
The number of trial days that were applied for this subscription.
planCurrency String
The currency code for the subscription. i.e. usd.
formatPlanNameShort
A short formatted version of the plan details.
stripeLink String
A helper string to link directly to a subscription in the Stripe dashboard. Returns similar to : https://dashboard.stripe.com/test/plans/sub_00000000