#CallMeLaNN
1 messages · Page 1 of 1 (latest)
If the first invoice is with amount zero, a pending_setup_intent will be created instead. You can expand pending_setup_intent to get its client secret to complete the payment method collection: https://stripe.com/docs/api/subscriptions/object#subscription_object-pending_setup_intent
ooh, That is the part I have to focus. I've seen the pending_setup_intent before. I believe I have to fetch it since it is not expandable, just an ID form the created subscription payload.
Correct, would need to be expanded (like latest_invoice)
You can pass the expand parameter in your Subscription creation
So I think I have to handle both pending_setup_intent.client_secret and latest_invoice.payment_intent.client_secret see which one is available isn't it?
Ok, I just remember, I can do that.
Corect yes, you'd need logic to determine whether you need to handle a Setup or Payment Intent
There'd only ever be one of pending_setup_intent or latest_invoice[payment_intent]
What will be the logic to expect it must be Setup or Payment Intent at certain situation? I think I just check which one available, should be safe?
Basically whenever there's no initial payment (i.e. trial, 100% coupon, etc) then it'll be a pending_setup_intent
You'd just need to check for the presence of the pending_setup_intent field in your create response
Ok then. So once this one work, will Stripe send invoice for $0?
Well we don't send any emails in test mode
Ok, I did it on prod and it work for $xx some number, not happening on $0 for 100% coupon yet, not sure because stuck on this.
I believe we don't send the $0 amount invoices no. You'd need to manually send those (they do exist, we just don't email them)
One last thing. Once the trial and coupon ends, customer credit card will be automatically deducted?
It should be yep, assuming you collected one and confirmed the Setup Intent correctly
Feel free to use a test clock to see how the billing lifecycle works: https://stripe.com/docs/billing/testing/test-clocks
Good to know this 👍
Thank you for your prompt answer. Much appreciated.