Skip to content

Subscription trials #6890

@frankie567

Description

@frankie567

It's finally happening 😄

Design decisions

  • Products should support to add a trial configuration
  • Checkouts and Checkout Links should be able to override the trial configuration, with the same parameters
  • Merchants should be able to extend the trial period on existing subscriptions

Trial configuration

Stripe only supports a "number of days", which is a bit limiting IMO — and not always in line with the subscription interval. Typically, merchants would like to offer "1 month" trial, which is not always the same as "30 days".

We'll adopt the approach took by Lemon Squeezy, where the trial configuration consists of an interval and a number of cycles.

Payment method

Currently, we'll focus on a Checkout where the payment method is required. We'll consider supporting to create trials without payment method later.

Technical implementation

Subscription creation

Similar to Stripe, we'll add a trial_start and trial_end timestamp to the Subscription model to keep track of the beginning and the end of the trial. If None, then this Subscription doesn't have a trial period.

When in the trial period, the Subscription should have the trialing status. Make sure the benefits are correctly granted with this state.

When the Subscription is created with a trial, current_period_start and current_period_end should be equal to trial_start and trial_end; meaning the trial period is handled like a normal period. This way, it'll automatically be picked up by the scheduler task when the period ends. At that stage, we can switch the subscription from trialing to active, issue the order and start cycling normally. trial_start and trial_end are left untouched to keep track of the trial that was applied.

Trial period extension

The merchant should be able to extend the trial period. Two cases:

  • The Subscription is still trialing: we just need to update the trial_end and current_period_end so we postpone the next cycle
  • The Subscription is active (maybe some cycles were paid): update trial_start to "now" and update the trial_end and current_period_end so we postpone the next cycle. Basically, we tell the system to "skip" cycles.

Other considerations

  • Checkout should compute and store trial_end to display it properly to the customer
  • Introduce a union type for ProductCreate, since the trial fields are only applicable to the product with recurring interval set

Metadata

Metadata

Assignees

Labels

featureNet new feature development

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions