Start subscriptions with a free trial

trial_days, trial_ends_at and trial_once when creating subscriptions (app and
user token) and per subscription of checkout sessions. isTrial() on
subscriptions, the subscription.trial_will_end event type, and the
trial_already_used error code in the docs.
This commit is contained in:
Maurice Preuß committed 2026-11-04 21:23:52 +01:00
1 parent 61385df92f
commit 5cc1a519c3
10 files changed
+130 -9

No files matched your search

+7 -1
View File
@@ -24,7 +24,10 @@ class Subscriptions extends BaseCollection
* predecessor_id?: null|string,
* vat_rate: float,
* payload: null|array,
* ends_at: null|string
* ends_at: null|string,
* trial_days?: null|int,
* trial_ends_at?: null|string,
* trial_once?: bool
* } $attributes The subscription data:
* - group: The group (optional)
* - name: The name
@@ -36,6 +39,9 @@ class Subscriptions extends BaseCollection
* - vat_rate: The VAT rate (required when set)
* - payload: The payload (optional)
* - ends_at: The end date (optional)
* - trial_days: A free trial of 1–365 days from the user's confirmation on (optional)
* - trial_ends_at: Or a fixed end of the free trial (ISO 8601, in the future; optional)
* - trial_once: Refuse the trial if the user already had one with the app in the group (optional)
* @throws Throwable
*/
public function create(array $attributes): Subscription