#manzano55
1 messages · Page 1 of 1 (latest)
Hello manzano55, we'll be with you shortly! Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
• manzano55, 1 day ago, 35 messages
the trial_end parameter is within the subscription_data parameter, it sounds like you may be sending this param at the top level of the API call params rather than nested within that param
If you need help with the syntax, just let me know what language you are using
hello
i'm using the right syntax now:
public function createCheckoutSession($plan_label, $price_id): string
{
/** @var User $user */
$user = auth()->user();
$user->createOrGetStripeCustomer();
$stripe_return_url = env('STRIPE_RETURN_URL');
if ($user->isPremium()) {
$url = $user->billingPortalUrl($stripe_return_url);
return response()->json(['session_url' => $url]);
}
return $user->newSubscription($plan_label, [$price_id])->checkout([
'tax_id_collection' => ['enabled' => true],
'success_url' => $stripe_return_url,
'cancel_url' => $stripe_return_url,
'subscription_data' => [
'trial_settings' => ['end_behavior' => ['missing_payment_method' => 'cancel']],
'trial_period_days' => 30,
],
])->asStripeCheckoutSession()->url;
}
i'm using Laravel
now it working but, it still asking for payment details
I wanted the user to be able to start the free trial without having to enter card details, etc.
is that possible?
Good question, checking in to whether Checkout can skip this
You may have to just create the Subscription directly and collect PM info later via a hosted invoice page or Checkout in setup mode
hmm ok
i will try that
Another thing I would like to ask, I added the cancel_url and success_url to my platform, but because it is a temporary redirect, my platform does not accept it and sends the user to the login screen, do you know what can happen in my application that is making this happen?
Unfortunately I don't have a strong idea of what that could be. We should just do a simple redirect to the URL provided, so I think the next step would be debugging what happens on your server from that point
hmm ok
i will make an adaptation
last question, After the user has gotten the free trial, can I make it so they can no longer get it? Or is this already standard?
Stripe doesn't enforce that on your side unfortunately, so it would be a matter of checking that on your side and not creating checkout with a trial if so