Closed paulcanning closed 5 years ago
Trial dates in Cashier take precedence over Stripe trial days because Cashier allows you to work with a trial period without a credit card up front. That's why a custom way of working with trial days was built in. You should just leave your trial days on plans untouched when creating them.
When a subscription is created, the trial_ends_at
parameter on the subscription will be set from whatever trial days you're passing with the trialUntil
or trialDays
methods.
I've sent in a PR to add a note about this to the docs: https://github.com/laravel/docs/pull/5271
So if I make a price plan on Stripe with no trial set, and I set one in Cashier, how does it know when to bill the customer?
If it subscribes the customer to that plan in Stripe, its going to start billing them right away?
So if I make a price plan on Stripe with no trial set, and I set one in Cashier, how does it know when to bill the customer?
Like I said above, it overwrites the trial_ends_at
parameter when it creates a subscription. See https://stripe.com/docs/api/subscriptions/create#create_subscription-trial_end
@driesvints sorry, so just to be clear, even if a plan has a trial period set, individual customers can have a custom trial period? (ignoring Cashier, is this something that Stripe does?)
@paul-gene the trial_ends_at
parameter is meant to overwrite the plan's trial period so each subscription can have its custom trial ending. So basically, yes.
Thank you for clarifying :)
Could Cashier not have a method trialFromPlan()
? Stripe sets trial_from_plan
to false by default, it means you will always need to specify it in the code... I would like to be able to use the one I set straight on Stripe and avoid to have to go change my ENV variables...
@tquiroga this isn't supported unfortunately.
@driesvints That could be easily added I believe and would allow people to not have to match their code with what they set in Stripe.
So if I understand this correctly, the skipTrial method is for existing subscriptions that have a trial_ends_at parameter already filled to remove it for whatever reason.
I was a bit confused at first. I assumed the default behavior of cashier was to honor any existing default trial period in the stripe plan it is about to use and I could use that method to skip the trial. Perhaps it could be included in the notes? Took me a minute to realize that was happening. Especially because it mentions this bit...
"When using the trialDays method, Cashier will overwrite any default trial period configured for the plan in Stripe."
This should probably be changed to explain cashier will not use any default trial period whether trialDays method is used or not. And it only honors the trialDays or trialUntil method for defining a trial period.
I made a new plan in Stripe, giving it a 30 day trial period.
I have then subscribed a user to this plan, and whilst the subscription table now has a new record, it's missing the trial_ends_at date.
I see in the docs I can set the number of trial days, but surely that defeats the purpose of setting it in Stripe?
Which one takes precedence? If my plan in Stripe is set to 30 days, and I set it to 10 or even 60 in Laravel, which one is actually used?
What am I missing?