#furbox-php-subscription
1 messages · Page 1 of 1 (latest)
@rocky sage I'm not sure I follow what you mean. Do you want 30 days of trial and then an entire month not paid until the end of month?
I want the trial month and when I finish charge the plan
So what's blocking you exactly?
From the start of the trial period, the plan charges
How are you creating the subscription exactly?
That's just Dashboard screenshots
All I'm asking is how exactly you create the subscription: what is your code
damn so many pictures of code
jaja
all I was asking is the exact line of code creating the subscription. You're the dev here, I can't really tweak a picture of code
But really the problem is that you are assuming we will use the trial period of the Price (which is fair) but we don't
public function checkout($id_product) {
header('Content-Type: application/json');
try {
$prices = \Stripe\Price::all([
// retrieve lookup_key from form data POST body
'lookup_keys' => [$id_product],
'expand' => ['data.product']
]);
$checkout_session = \Stripe\Checkout\Session::create([
'line_items' => [[
'price' => $prices->data[0]->id,
'quantity' => 1,
]],
'mode' => 'subscription',
'success_url' => base_url('success?session_id={CHECKOUT_SESSION_ID}'),
'cancel_url' => base_url('cancel'),
]);
header("HTTP/1.1 303 See Other");
header("Location: " . $checkout_session->url);
} catch (Error $e) {
http_response_code(500);
echo json_encode(['error' => $e->getMessage()]);
}
}
We recommend explicitly setting this instead: https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-subscription_data-trial_period_days
I think I'm misconfiguring the product with the trial period
no you did not. We just completely ignore that trial period
so don't do it/rely on it and explicitly set the trial on the Checkout Session itself
Let me know if that doesn't fix your issue!