Subscription Variables

For Subscription variables to be available they must be used on a page with the subscription action selected. 

For all the subscription variables that return objects, you can view the contents of the full object by displaying them on a page in your LemonStand store. Navigate to a page with access to subscription variables and enter the object you want to view in curly brackets.

For example, this:

<p> {{ subscription.billing_plan }} </p> 

Will display something like this on the page:

{"id":1,"name":"Monthly","schedule_type":"monthly","is_continuous":0,"price":"0.00",
"trial_length":0,"billing_day":0,"created_at":"2017-01-04 10:14:36","updated_at":"2017-01-23 15:18:18",
"x_days":null,"code":"monthly","setup_fee_or_percentage":"20","discount_percentage":"10%",
"sync_billing_date_enabled":0,"sync_billing_date":null,"charge_on_creation":1,"weekly_day":null,
"monthly_day_type":null,"monthly_day":null,"last_sync_billing_date":null}

Now lets say you want to display just the name of the billing plan. You can input this:

<p> {{ subscription.billing_plan.name }} </p>

And it will display: Monthly

These objects hold a lot of information that might not be mentioned in the documentation. So if you are missing needed information that you want to be displayed, try printing the full objects. Only commonly used objects will appear in the documentation.


Variable Usage
subscription.products Returns a collection of products in the subscription.
{% for subscriptionProduct in subscription.products %}
  {{ subscriptionProduct.id }}
  {{ subscriptionProduct.product.name }}
{% endfor %}
subscription.customer Returns information about the customer the subscription belongs to.
{{ subscription.customer.first_name }}
subscription.billing_plan Returns an object containing information about the billing plan of the subscription.
Subscription Billing Plan Object: {{ subscription.billing_plan }}
Example of object's contents:
{{ subscription.billing_plan.id }}
{{ subscription.billing_plan.name }}
{{ subscription.billing_plan.schedule_type }}
subscription.billing_status Returns an object containing information about the billing status of the subscription.
Subscription Billing Status Object: {{ subscription.billing_status }}
Example of object's contents:
{{ subscription.billing_status.id }}
{{ subscription.billing_status.name }}
{{ subscription.billing_status.code }}
subscription.status Returns an object containing information about the status of the subscription.
Subscription Status Object: {{ subscription.status }}
Example of object's contents:
{{ subscription.status.id }}
{{ subscription.status.name }}
{{ subscription.status.code }}
subscription.billing_log Returns a collection of bill objects containing information about bills.
{% for bill in subscription.billing_log %}
 {{ bill }}
 {{ bill.id }}
 {{ bill.created_at }}
 {{ bill.status }}
{% endfor %}
subscription.nextRenewalAmount() Returns the total due on next renewal
{{ subscription.nextRenewalAmount() }}
subscription.nextRenewalDate() Returns the next renewal date.
{{ subscription.nextRenewalDate()|date("m/d/Y") }}
subscription.nextInvoiceDate() Alias for nextRenewalDate().
{{ subscription.nextInvoiceDate()|date("m/d/Y") }}
subscription.nextNextInvoiceDate() Returns a subscription's next-next invoice date.
{{ subscription.nextNextInvoiceDate()|date("m/d/Y") }}
subscription.billing_plan.setup_fee_or_percentage Returns billing plan set up fee. Note that the calculated setup fee's flat amount is saved to any orders created. This is listed under the Order Variables​ doc page.
{{ subscription.billing_plan.setup_fee_or_percentage }}
{{ order.setup_fee }} // saved calculated amount
subscription.status_log Returns a collection of status objects containing information about past statuses.
{% for status in subscription.status_log %}
 {{ status }}
{% endfor %}
subscription.orders Returns a collection of order objects that contain information about each order.
{% for order in subscription.orders %}
 {{ order }}
{% endfor %}
subscription.payment_method Returns an object containing information about the payment method used.
{{ subscription.payment_method }}
subscription.shipping_method Returns an object containing information about the shipping method used.
{{ subscription.shipping_method }}
subscription.getLatestBillingLog() Returns an object containing information about the latest subscription bill.
{{ subscription.getLatestBillingLog() }}
subscription.created_at Returns a string containing the date created.
{{ subscription.created_at.format('M jS, Y') }}
subscription.coupon_code Returns the coupon code saved to the subscription.
{{ subscription.coupon_code }}
subscription.card Returns a saved card the subscription is recharged against.
{{ subscription.card.brand }}
subscription.card.brand Returns the brand of a saved card the subscription is recharged against (e.g. 'MasterCard').
{{ subscription.card.brand }}
subscription.card.card_and_brand Returns the card number and brand of a saved card the subscription is recharged against (e.g. 'XXXX-XXXX-XXXX-4444 (MasterCard)').
{{ subscription.card.card_and_brand }}
subscription.card.sanitized_card_number Returns the sanitized card number of a saved card the subscription is recharged against (e.g. 'XXXX-XXXX-XXXX-4444').
{{ subscription.card.sanitized_card_number }}
subscription.card.last_4 Returns the last four digits of a saved card the subscription is recharged against (e.g. '4444').
{{ subscription.card.last_4 }}
subscription.custom_field_name Returns a Order/Cart custom field value if the custom field name has a value linked to the subscription. These fields can be edited in the Admin area, in the Subscription Edit Page.
{{ subscription.custom_field_name }}
subscription.getCustomFieldsString() Returns a comma-separated string of custom field values attached to the Subscription.
{{ subscription.getCustomFieldsString() }}
subscription.getCustomFieldsArray() Returns an array of custom fields to loop through and display.
{% for field in subscription.getCustomFieldsArray() %}
    {{ field }}
{% endfor %}
subscription.canReschedule() Returns true/false if a billing plan has the setting "Allow customers to reschedule or skip dates" enabled.
{{ subscription.canReschedule() }}
subscription.canGenerateOrder() Returns true/false if a billing plan has the setting "Allow customers to generate extra paid orders" enabled.
{{ subscription.canGenerateOrder() }}
subscription.schedule() Returns a read-friendly schedule, examples:
"16th of the month"
"Every Tuesday"
"Every 5 days"
"First day of the month"
{{ subscription.schedule() }}
subscription.getMonthlyDay() Returns read-friendly day of the month for synchronized monthly plans only, e.g. "First day", "Last Day", "24th", "10th", etc.
{{ subscription.getMonthlyDay() }}
subscription.getWeeklyDay() Returns the day of the week for synchronized weekly billing plans only, e.g. Monday, Tuesday, etc.
{{ subscription.getWeeklyDay() }}
subscription.getWeeklyDayNumber() Returns the number of the day of the week for synchronized weekly billing plans only, e.g. 1 for Monday, 2 for Tuesday, etc.
{{ subscription.getWeeklyDayNumber() }}
subscription.getScheduleType() Returns the subscription’s schedule type, options: Monthly, Weekly, Daily.
{{ subscription.getScheduleType() }}
subscription.isSynchronized() Returns a true/false if the subscription's billing plan has "Charge subscriptions on a synchronized date" enabled.
{{ subscription.isSynchronized() }}
subscription.billingAddress Returns a subscription's billing address.
{% if subscription.billingAddress %}
  Address: {{ subscription.billingAddress.street_address }}
{% endif %}
subscription.shippingAddress Returns a subscription's billing address.
{% if subscription.shippingAddress %}
  Street: {{ subscription.shippingAddress.street_address }}
{% endif %}