$0 Set Length Subscriptions
Sometimes you'll want to have a set length subscription but offer it for free.
You can achieve this by setting the plan_balance to a negative value equal to the plan_amount.
NOTE: The plan_balance parameter does not work with one-time charges.
NOTE: The plan_balance parameter can ONLY be set in the exp:charge:form tag for security purposes. It cannot be set via an input field.
To set a length on a subscription, add a new field or parameter on the form called plan_length. The length is defined similar to how recurring payments are managed. Simply set a numerical value, to indicate the number of periods (ie. 6).
NOTE: The plan_length must be between 1-52 weeks, 1-12 months, or 1 year. Longer than a year is not allowed by Stripe.
The plan_length_interval can be set as week, month, or year. If not set, it will default to the plan_interval value (if set) or default to month otherwise.
Plan length can be set both on the form and as a parameter on the form. Length values set via parameters will override any set as form inputs.
{exp:charge:form
form_class="form-horizontal"
form_id="charge-form"
return="{segment_1}/thanks"
return_error="{segment_1}/error"
plan_amount="795"
plan_balance="-795"
plan_currency="usd"
plan_interval="month"
plan_interval_count="12"
plan_length="12"
plan_length_interval="month"
}
// Standard payment fields ..
{/exp:charge:form}
What Happens In Stripe
When you put through a $0 transaction, Stripe creates the plan:

A Stripe Customer is also created (if it doesn't exist already)

The plan is associated with the Customer, an invoice is created and paid, and for set length subscriptions, the subscription is cancelled with the "at_period_end" flag set; meaning it's active until the end of the plan length but will not rebill.

The invoice is created and the customer's negative account balance is used for payment.
