#zuberpatel
1 messages · Page 1 of 1 (latest)
Hi there!
How are you creating the Subsription? With Payment Link, Checkout Session, or directly with the Subscription endpoint?
Hello, I would appreciate your help
Checkout session
I have two subscriptions both with checkout session.
But in one of them I passed price_id and for another one I passed payment_data to create temporary product as user can subscribe to any amount they wish for.
Then you should listen to checkout.session.completed to know when the subscription starts, and invoice.paid to know when the subscription should renew.
You can learn more about subscription events here: https://stripe.com/docs/billing/subscriptions/webhooks
Perfect.
Also, Does Stripe send automated email to user after payment success or failure?
Depends on your settings in your Stripe dashboard https://dashboard.stripe.com/settings/billing/automatic and https://dashboard.stripe.com/settings/emails
Thanks
Sorry last one,
Will it also send email if it's in local environment or only sent when it's live?
We don't send any emails in test mode. So it's only in live mode.
To create a subscription without product/price_id which one is best option using PHP laravel.
\Stripe\Checkout\Session::create(['line_items' => [
[
'price_data' => [
'currency' => 'gbp',
'unit_amount' => $product->unit_amount,
'recurring' => ['interval' => 'monthly'],
'product_data' => [
'name' =>'Donation',
'description' =>'=>'Donation',
'images' => [url('/images/' . $product->file_path)],
],
],
'quantity' => 1,
]],"metadata" => [
"product_id" => $request->product_id,
"student_registrations_id" => $request->student_registrations_id, "category_id" => $request->category_id],
'mode' => ($product->interval != 'single') ? 'subscription' : 'payment',
'success_url' => url('/').'/student-payment-success?session_id={CHECKOUT_SESSION_ID}',
'cancel_url' => url('/').'/registration/' . $request->product_id . '/' . $request->category_id,
]);