#evan_09475
1 messages · Page 1 of 1 (latest)
Hello! That's expected behavior - when a Subscription is trialing there's no payment due, so there's no reason to create a Payment Intent.
Instead, you can grab a Setup Intent from pending_setup_intent on the Subscription and use it to collect pamynet details
this is the object am passing to the create method
let subscriptionData = {
customer: paymentObj.providerCustomer.stripeCustomerId,
items: [
{
plan: stripePlanId
}
],
payment_behavior: 'default_incomplete',
payment_settings: { save_default_payment_method: 'on_subscription' },
expand: ['latest_invoice.payment_intent']
}
I need to change to this I beleieve
expand: ['latest_invoice.payment_intent', 'pending_setup_intent'],
Yup! That way you'll get the full Setup Intent expanded and can get the client secret
the fullset up payment intent is having status: 'requires_payment_method', although I have already passed paymentMethod when creating the subscription and the customer
Is that normal?
Hi can you share the payment intent id?
seti_1No9nFD9sYh65PYtvWYuroxc
Oh that's a setupintent
Also payment method was never provided. That's why
That setupintent is to collect payment method data for the subscription. But, if your customer already has a default payment method attached, then you shouldn't need to do that step
Their default pm will be charged once the trial is over
Although the customer you provided doesn't have a default payment method set, so the first subscription payment will fail
but am passing the paymentMethod when I create the customer
const response = await this.stripeGateway.customers.create({
email: user.email,
name: paymentObj.payeeName,
payment_method: paymentObj.paymentMethod,
metadata: { zendyUserId: user.id, zendy: 'Zendy OA' }
})
Yeah that doesn't matter though. Subscriptions only charge the payment method set as default
You can have many payment methods on a customer
So you need to set a default
Okay so you mean when I create a customer I have to pass
invoice_settings : {
default_payment_method: id of the payment method
}
Yeah that would be how to set the pm as the customer's default
There's actually a couple places you can set the pm as the default though. The above is for setting it at the customer level, but you can also set it at the subscription level here: https://stripe.com/docs/api/subscriptions/create#create_subscription-default_payment_method
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
They will behave the same right?
Yes, but if it's set on the subscription level, that overrides/takes precedence over the one set on the customer
When Passing the default_payment_method to the customer the status of the setup payment intent is status: 'requires_confirmation'
that is the id of the set up intent
seti_1NoAFQD9sYh65PYtDVghb6mr
Yeah that's unrelated
The point of that setupintent is to give you an opportunity to collect new payment details
Which you don't do
Every sub with a trial creates a setupintent
the code earlier I provided was confirming the paymentIntent.
In my case, when I do a trial subscription, Do I have to confirm the setupIntent
No not necessary