#zuberpatel

1 messages · Page 1 of 1 (latest)

placid stagBOT
crimson drift
#

Hi there!

#

How are you creating the Subsription? With Payment Link, Checkout Session, or directly with the Subscription endpoint?

wispy otter
#

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.

crimson drift
#

Then you should listen to checkout.session.completed to know when the subscription starts, and invoice.paid to know when the subscription should renew.

wispy otter
#

Perfect.
Also, Does Stripe send automated email to user after payment success or failure?

crimson drift
wispy otter
#

Thanks

#

Sorry last one,
Will it also send email if it's in local environment or only sent when it's live?

crimson drift
#

We don't send any emails in test mode. So it's only in live mode.

wispy otter
#

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,
]);