#LST
1 messages · Page 1 of 1 (latest)
No, but its usage based billing (in arrears)
Could it be because the customer already has a payment method defined?
The subscription is active right away as it seems
Ah yeah with Metered billing you are post-billing (arrears) so the first Invoice will always be $0 which is why there is no PaymentIntent
But there should be a pending_setup_intent that you use instead here to collect a payment method
So you expand pending_setup_intent and grab the pending_setup_intent.client_secret and use that with confirmSetup() on the frontend.
Is it the same for the frontend, i.e. can I just use <PaymentElement /> too?
Hmm, pendingSetupIntent is also null
Can you give me the Subscription ID that you tested with?
sub_1NOL1IDTiSONMGIuewQfidlN
So if you look at the creation request (https://dashboard.stripe.com/test/logs/req_RewFUsjxNC3DhP) you can see in the response that there is a pending_setup_intent
So it sounds like you may just be grabbing it incorrectly
You're right 🤔
In my backend I have this code, copied from the guide (kotlin though):
val subscription = Subscription.create(subCreateParams)
val clientSecret = subscription.pendingSetupIntentObject.clientSecret
and subscription.pendingSetupIntentObject (= subscription.getPendingSetupIntentObject()) is null
Oh do i have to add pending_setup_intent to the expand list?
Yep
Great thanks, working now!
However, can I prevent the subscription from being active immediately? I would want it to be active only after a payment method has been set
No this isn't possible since there is no initial payment
It will always be active... you will need to listen for Webhooks to know when a payment method was attached
And then you could either cancel the Subscription if no payment method or set it as "active" in your database
Is there a way to have initial billing for the flat fee and billing in arrears for the usage-based fees?
Can I create both simultaneously? Like have one checkout button using the elements?
You can have one Subscription with two Prices, yes. As long as the billing intervals are the same (ie both monthly)
Could I also have two subscriptions with differing billing cycles which would be subscribed to at the same time (e.g. have a yearly fee with monthly billed usage)?
You can do this if they are two different Subscriptions, yes.
A Customer can have multiple Subscriptions
nvm
If I create two prices for one subscription and then create a stripe checkout session for that subscription, it will be the checkout for both prices if I define it right?
Because my problem is that it shows 0.00$ due today and hides the actual prices in the "See details" tab. But if I split the flat fee into its own price it would be billed at the beginning?
Do you just want it to bill one time? Or the flat fee should occur on each billing cycle on top of the usage-based Price as well?
The flat fee should be at the start of the month, and the usage based billing at the end (optimally). Now, its both in arrears with usage-based price, but the problem is the "0.00$ due today"
Yep okay then what is suggested above will work well
Okay great, thanks!
Sure!