With the actual implementation, it is not possible to make use of a new billing anchor but Stripe is supporting it through their API.
Stripe allows the usage of trial_end and billing_cycle_anchor inside the checkout process.
The line 354 ( https://github.com/laravel/cashier-stripe/blob/15.x/src/SubscriptionBuilder.php#L354 ) sets the variable billingCycleAnchor to null if there is a trialEnd given, but this line only represents the possibility of stripes frontend and not the capability of their API which can handle the presence of both variables correctly.
If a change on this line will be planned I would suggest the usage of an environment that allows to switch the behavior before breaking many integrations.
Actual behavior:
Date: 26.06.2024
A new checkout with the given trial end set to 11.07.2024 and the given billing cycle anchor set to 01.07 or 01.08 would create a new subscription with the billing cycle set to 11.07 or even 26.06 but not to the given billing cycle anchor.
Subscription Billing cycle 11.07 -> 11.08
Requested behavior with a set environment variable:
Date: 26.06.2024
A new checkout with a given trial end set to 11.07.2024 and the given billing cycle anchor set to 01.07 would create a new subscription with a trial end at 11.07 but the billing cycle will start correctly at 01.07
Subscription Billing cycle 01.07 -> 01.08
Stripe will handle the needed calculation of the proration and the correctly calculated trial period inside the actual billing cycle.
With the actual implementation, it is not possible to make use of a new billing anchor but Stripe is supporting it through their API. Stripe allows the usage of
trial_end
andbilling_cycle_anchor
inside the checkout process.The line 354 ( https://github.com/laravel/cashier-stripe/blob/15.x/src/SubscriptionBuilder.php#L354 ) sets the variable
billingCycleAnchor
to null if there is atrialEnd
given, but this line only represents the possibility of stripes frontend and not the capability of their API which can handle the presence of both variables correctly.If a change on this line will be planned I would suggest the usage of an environment that allows to switch the behavior before breaking many integrations.
Actual behavior: Date: 26.06.2024 A new checkout with the given trial end set to 11.07.2024 and the given billing cycle anchor set to 01.07 or 01.08 would create a new subscription with the billing cycle set to 11.07 or even 26.06 but not to the given billing cycle anchor. Subscription Billing cycle 11.07 -> 11.08
Requested behavior with a set environment variable: Date: 26.06.2024 A new checkout with a given trial end set to 11.07.2024 and the given billing cycle anchor set to 01.07 would create a new subscription with a trial end at 11.07 but the billing cycle will start correctly at 01.07 Subscription Billing cycle 01.07 -> 01.08
Stripe will handle the needed calculation of the proration and the correctly calculated trial period inside the actual billing cycle.
Documentation of stripe: https://docs.stripe.com/billing/subscriptions/trials#combine-trial-anchor