Skip to content
This repository has been archived by the owner on Jan 2, 2024. It is now read-only.

api: support free trials #203

Merged
merged 1 commit into from
Dec 19, 2022
Merged

api: support free trials #203

merged 1 commit into from
Dec 19, 2022

Conversation

bmizerany
Copy link
Contributor

This changes the API to accept a Trial field for a Phase making it trial
phase in Stripe, avoid any incurring of fees until the end of the trial.

This also adds the --trial= flag to the CLI subscribe subcommand
for specifying that the features listed will be available in two phases,
the first is the trial phase that lasts the number of days specified,
and the next is the paid phase that lasts indefinitely.

@bmizerany bmizerany marked this pull request as ready for review December 13, 2022 01:51
@bmizerany bmizerany force-pushed the freetrial branch 5 times, most recently from 84b940d to eb7ff67 Compare December 19, 2022 22:44
This commit adds a Trial field to the Phase object accepted by the API
for creating and updating subscriptions and schedules. The new Trial
field tell Stripe to count the Phase as a trial phase, which Stripe will
honor by counting all features as free during the lifetime of the Phase.

This also adds the --trial=<days> flag to the CLI subscribe subcommand
for specifying trial periods. If days is negative, then a single phase
is scheduled as a trial that never ends. If days is zero, a single
non-trial phase is scheduled with the features/plans provided. If days
is positive, a trial phase is scheduled ending after the number of days
provided, followed by a phase that never ends for the features/plans
provided.
@bmizerany
Copy link
Contributor Author

How to test:

; tier push p.json
; tier subscribe --trial=14 org:example plan:pro@0
; tier whoami

Click the dashboard link and verify org:example is trialing.

; tier subscribe --trial=0 org:example plan:pro@0

Check org:example is active/no longer trialing.

@bmizerany bmizerany merged commit 313127f into main Dec 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant