#LST

1 messages · Page 1 of 1 (latest)

livid sirenBOT
broken bronze
#

Hello there

#

Are you using a trial?

edgy salmon
#

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

broken bronze
#

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.

edgy salmon
#

Is it the same for the frontend, i.e. can I just use <PaymentElement /> too?

#

Hmm, pendingSetupIntent is also null

broken bronze
#

Can you give me the Subscription ID that you tested with?

edgy salmon
#

sub_1NOL1IDTiSONMGIuewQfidlN

broken bronze
#

So it sounds like you may just be grabbing it incorrectly

edgy salmon
#

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?

broken bronze
#

Yep

edgy salmon
#

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

broken bronze
#

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

edgy salmon
#

Is there a way to have initial billing for the flat fee and billing in arrears for the usage-based fees?

broken bronze
#

Yep

#

You can use two Prices

edgy salmon
#

Can I create both simultaneously? Like have one checkout button using the elements?

broken bronze
#

You can have one Subscription with two Prices, yes. As long as the billing intervals are the same (ie both monthly)

edgy salmon
#

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)?

broken bronze
#

You can do this if they are two different Subscriptions, yes.

#

A Customer can have multiple Subscriptions

edgy salmon
#

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?

broken bronze
#

Yep

#

You would pass multiple line_items when creating your Checkout Session

edgy salmon
#

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?

broken bronze
#

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?

edgy salmon
#

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"

broken bronze
#

Yep okay then what is suggested above will work well

edgy salmon
#

Okay great, thanks!

broken bronze
#

Sure!