#tehalsingh_22956
1 messages ยท Page 1 of 1 (latest)
๐ happy to help
if you create a subscription with a trial period or a 100% discount you will get a null latest_invoice.payment_intent
in these case you need to use subscription.pending_setup_intent
would you mind sharing an example?
I'm using php code
$data['customer'] = $user->stripe->stripe_customer_id;
$data['items'] = [
[
'price' => $selectedPlan->stripe_plan_id
],
];
$data['expand'] = ['latest_invoice.payment_intent'];
$data['off_session'] = true;
$data['payment_behavior'] = "allow_incomplete";
$subscription = \Stripe\Subscription::create($data);
Subscription object suppose to have latest_invoice.payment_intent in the response
Can you share the subscription ID that you're working with?
I see that the subscription does have an invoice attached, can you share the response you're getting from the API request?
Looks like the invoice was created for 0 amount
you're creating usage based subscription
https://dashboard.stripe.com/test/subscriptions/sub_1NaHsfCDMd8oJhR4s49ip7Cv
Invoices with 0 amount don't generate a PaymentIntent
https://dashboard.stripe.com/test/invoices/in_1NaHsfCDMd8oJhR4QgXGBlGd
Exactly, why 0, you can check plan doesn't have any trail or coupon, https://dashboard.stripe.com/test/prices/price_1KDloDCDMd8oJhR42aI2Owk6
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Because the subscription when its created won't have any usage reported
You can look at the invoice itself, since there no usage, there won't be any billing
Hence subscription has "pending_setup_intent": "seti_1NaHsgCDMd8oJhR4fzf4TpfE"
This allows you to collect payment method
using elements
okey, in this case do we need to cancel the subscription if card authencation is failed.
It is upto you. You as a merchant control the whole flow/experience ๐
I mean it's required or not.
Depends on your usecase.
okey
can you suggest the laravel laravel/cashier version.
As i have to retreive the setupintent
My laravel version is 5.7 and laravel/cashier: 7.0
in the current version of my stripe sdk SetuIpntent class is missing
What version of Stripe SDK are you running? The SetupIntents have been present since many versions
Also, our team on discord won't know a ton about the specific version you need with laravel. You'd need to look at the documentation we have available and decide accordingly.